home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / Dos.mod < prev    next >
Text File  |  1995-06-29  |  84KB  |  2,457 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Dos.mod $
  4.   Description: Interface to dos.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. *************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] Dos;
  25.  
  26. IMPORT
  27.   SYS := SYSTEM, Kernel, e := Exec, t := Timer, u := Utility,
  28.   s := Sets;
  29.  
  30.  
  31. (**-- Pointer declarations ---------------------------------------------*)
  32.  
  33. TYPE
  34.  
  35.   DatePtr*                  = POINTER TO Date;
  36.   FileInfoBlockPtr*         = POINTER TO FileInfoBlock;
  37.   InfoDataPtr*              = POINTER TO InfoData;
  38.   DateTimePtr*              = POINTER TO DateTime;
  39.   AChainPtr*                = POINTER TO AChain;
  40.   AnchorPathPtr*            = POINTER TO AnchorPath;
  41.   DosEnvecPtr*              = POINTER [3] TO DosEnvec;
  42.   FileSysStartupMsgPtr*     = POINTER [3] TO FileSysStartupMsg;
  43.   DeviceNodePtr*            = POINTER TO DeviceNode;
  44.   NotifyRequestPtr*         = POINTER TO NotifyRequest;
  45.   NotifyMessagePtr*         = POINTER TO NotifyMessage;
  46.   CSourcePtr*               = POINTER TO CSource;
  47.   RDArgsPtr*                = POINTER TO RDArgs;
  48.   RecordLockPtr*            = POINTER TO RecordLock;
  49.   LocalVarPtr*              = POINTER TO LocalVar;
  50.   ExAllDataPtr*             = POINTER TO ExAllData;
  51.   ExAllControlPtr*          = POINTER TO ExAllControl;
  52.   ProcessPtr*               = POINTER TO Process;
  53.   FileHandlePtr*            = POINTER [3] TO FileHandle;
  54.   DosPacketPtr*             = POINTER TO DosPacket;
  55.   StandardPacketPtr*        = POINTER TO StandardPacket;
  56.   TaskArrayPtr*             = POINTER [3] TO TaskArray;
  57.   RootNodePtr*              = POINTER TO RootNode;
  58.   ErrorStringPtr*           = POINTER TO ErrorString;
  59.   DosLibraryPtr*            = POINTER TO DosLibrary;
  60.   CliProcListPtr*           = POINTER TO CliProcList;
  61.   DosInfoPtr*               = POINTER [3] TO DosInfo;
  62.   SegmentPtr*               = POINTER TO Segment;
  63.   CommandLineInterfacePtr*  = POINTER [3] TO CommandLineInterface;
  64.   DeviceListPtr*            = POINTER [3] TO DeviceList;
  65.   DevInfoPtr*               = POINTER [3] TO DevInfo;
  66.   AssignListPtr*            = POINTER TO AssignList;
  67.   DosListPtr*               = POINTER [3] TO DosList;
  68.   DevProcPtr*               = POINTER TO DevProc;
  69.   FileLockPtr*              = POINTER [3] TO FileLock;
  70.   ProcessId*                = e.MsgPortPtr; (* Points to Process.msgPort *)
  71.   DosListNodePtr*           = POINTER TO DosListNode;
  72.  
  73. (*
  74. **      $VER: dos.h 36.27 (5.4.92)
  75. **
  76. **      Standard header for AmigaDOS
  77. *)
  78.  
  79. CONST
  80.  
  81.   dosName * = "dos.library";
  82.  
  83. (* Predefined Amiga DOS global constants *)
  84.  
  85.   DOSTRUE * = e.LTRUE;
  86.   DOSFALSE * = e.LFALSE;
  87.  
  88. (* Mode parameter to Open() *)
  89.   oldFile        * = 1005;   (* Open existing file read/write
  90.                               * positioned at beginning of file. *)
  91.   newFile        * = 1006;   (* Open freshly created file (delete
  92.                               * old file) read/write, exclusive lock. *)
  93.   readWrite      * = 1004;   (* Open old file w/shared lock,
  94.                               * creates file if doesn't exist. *)
  95.  
  96. (* Relative position to Seek() *)
  97.   beginning    * = -1;      (* relative to Begining Of File *)
  98.   current      * =  0;      (* relative to Current file position *)
  99.   end          * =  1;      (* relative to End Of File    *)
  100.  
  101.   bitsPerByte         * = 8;
  102.   bytesPerLong        * = 4;
  103.   bitsPerLong         * = 32;
  104.   maxInt              * = 7FFFFFFFH;
  105.   minInt              * = 80000000H;
  106.  
  107. (* Passed as type to Lock() *)
  108.   sharedLock         * = -2;     (* File is readable by others *)
  109.   accessRead         * = -2;     (* Synonym *)
  110.   exclusiveLock      * = -1;     (* No other access allowed    *)
  111.   accessWrite        * = -1;     (* Synonym *)
  112.  
  113. TYPE
  114.  
  115. (*
  116. ** Note that the type name has been changed from DateStamp to Date to
  117. ** avoid a name clash with the DateStamp() function.
  118. *)
  119.  
  120.   DateBase *= RECORD END;
  121.   DateBasePtr *= POINTER TO DateBase;
  122.  
  123.   Date* = RECORD (DateBase)
  124.     days  * : LONGINT;           (* Number of days since Jan. 1, 1978 *)
  125.     minute* : LONGINT;           (* Number of minutes past midnight *)
  126.     tick  * : LONGINT;           (* Number of ticks past minute *)
  127.   END; (* Date *)
  128.  
  129. CONST
  130.  
  131.   ticksPerSecond     * = 50;   (* Number of ticks in one second *)
  132.  
  133. TYPE
  134.  
  135. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  136.   FileInfoBlock* = RECORD
  137.     diskKey     * : LONGINT;
  138.     dirEntryType* : LONGINT;
  139.                             (* Type of Directory. If < 0, then a plain file.
  140.                              * If > 0 a directory *)
  141.     fileName    * : ARRAY 108 OF CHAR;
  142.                             (* Null terminated. Max 30 chars used for now *)
  143.     protection  * : s.SET32;(* bit mask of protection, rwxd are 3-0.      *)
  144.     entryType   * : LONGINT;
  145.     size        * : LONGINT;    (* Number of bytes in file *)
  146.     numBlocks   * : LONGINT;    (* Number of blocks in file *)
  147.     date        * : Date;  (* Date file last changed *)
  148.     comment     * : ARRAY 80 OF CHAR;
  149.                           (* Null terminated comment associated with file *)
  150.  
  151.     (* Note: the following fields are not supported by all filesystems.  *)
  152.     (* They should be initialized to 0 sending an ACTION_EXAMINE packet. *)
  153.     (* When Examine() is called, these are set to 0 for you.             *)
  154.     (* AllocDosObject() also initializes them to 0.                      *)
  155.     ownerUID    * : e.UWORD;      (* owner's UID *)
  156.     ownerGID    * : e.UWORD;      (* owner's GID *)
  157.  
  158.     reserved    * :  ARRAY 32 OF CHAR;
  159.   END; (* FileInfoBlock *)
  160.  
  161. CONST
  162.  
  163. (* fib stands for FileInfoBlock *)
  164.  
  165. (* Bit definitions *)
  166. (* Regular RWED bits are 0 == allowed. *)
  167. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  168. (* Group and Other permissions are not directly handled by the filesystem *)
  169.   otrRead    * = 15;       (* Other: file is readable *)
  170.   otrWrite   * = 14;       (* Other: file is writable *)
  171.   otrExecute * = 13;       (* Other: file is executable *)
  172.   otrDelete  * = 12;       (* Other: prevent file from being deleted *)
  173.   grpRead    * = 11;       (* Group: file is readable *)
  174.   grpWrite   * = 10;       (* Group: file is writable *)
  175.   grpExecute * = 9;        (* Group: file is executable *)
  176.   grpDelete  * = 8;        (* Group: prevent file from being deleted *)
  177.  
  178.   script     * = 6;        (* program is a script (execute) file *)
  179.   pure       * = 5;        (* program is reentrant and rexecutable *)
  180.   archive    * = 4;        (* cleared whenever file is changed *)
  181.   readProt   * = 3;        (* ignored by old filesystem *)
  182.   writeProt  * = 2;        (* ignored by old filesystem *)
  183.   execute    * = 1;        (* ignored by system, used by Shell *)
  184.   delete     * = 0;        (* prevent file from being deleted *)
  185.  
  186. (* Standard maximum length for an error string from fault.  However, most *)
  187. (* error strings should be kept under 60 characters if possible.  Don't   *)
  188. (* forget space for the header you pass in. *)
  189.   faultMax      * = 82;
  190.  
  191. TYPE
  192.  
  193. (* All BCPL data must be long word aligned.  BCPL pointers are the long word
  194.  *  address (i.e byte address divided by 4 (>>2)) *)
  195.  
  196.   BPTR* = SYS.BPTR;                         (* Long word pointer *)
  197.   BSTR* = POINTER [3] TO ARRAY 256 OF CHAR; (* Long word pointer to BCPL string *)
  198.  
  199. (* BCPL strings have a length in the first byte and then the characters.
  200.  * For example:  s[0]=3 s[1]=S s[2]=Y s[3]=S                             *)
  201.  
  202. (* returned by Info(), must be on a 4 byte boundary *)
  203.   InfoData* = RECORD
  204.     numSoftErrors* : LONGINT;      (* number of soft errors on disk *)
  205.     unitNumber   * : LONGINT;      (* Which unit disk is (was) mounted on *)
  206.     diskState    * : LONGINT;      (* See defines below *)
  207.     numBlocks    * : LONGINT;      (* Number of blocks on disk *)
  208.     numBlocksUsed* : LONGINT;      (* Number of block in use *)
  209.     bytesPerBlock* : LONGINT;
  210.     diskType     * : LONGINT;      (* Disk Type code *)
  211.     volumeNode   * : DeviceListPtr;(* BCPL pointer to volume node *)
  212.     inUse        * : LONGINT;      (* Flag, zero if not in use *)
  213.   END; (* InfoData *)
  214.  
  215. CONST
  216.  
  217. (* id stands for InfoData *)
  218.         (* Disk states *)
  219.   writeProtect * = 80;    (* Disk is write protected *)
  220.   validating   * = 81;    (* Disk is currently being validated *)
  221.   validated    * = 82;    (* Disk is consistent and writeable *)
  222.  
  223.         (* Disk types *)
  224. (* idInter* use international case comparison routines for hashing *)
  225.   noDiskPresent      * = -1;
  226.   unreadableDisk     * = 42414400H;   (* 'BAD\0' *)
  227.   dosDisk            * = 444F5300H;   (* 'DOS\0' *)
  228.   ffsDisk            * = 444F5301H;   (* 'DOS\1' *)
  229.   interDosDisk       * = 444F5302H;   (* 'DOS\2' *)
  230.   interFfsDisk       * = 444F5303H;   (* 'DOS\3' *)
  231.   notReallyDos       * = 4E444F53H;   (* 'NDOS'  *)
  232.   kickstartDisk      * = 4B49434BH;   (* 'KICK'  *)
  233.   msdosDisk          * = 4D534400H;   (* 'MSD\0' *)
  234.  
  235. (* Errors from IoErr(), etc. *)
  236.   noFreeStore              * = 103;
  237.   taskTableFull            * = 105;
  238.   badTemplate              * = 114;
  239.   badNumber                * = 115;
  240.   requiredArgMissing       * = 116;
  241.   keyNeedsArg              * = 117;
  242.   tooManyArgs              * = 118;
  243.   unmatchedQuotes          * = 119;
  244.   lineTooLong              * = 120;
  245.   fileNotObject            * = 121;
  246.   invalidResidentLibrary   * = 122;
  247.   noDefaultDir             * = 201;
  248.   objectInUse              * = 202;
  249.   objectExists             * = 203;
  250.   dirNotFound              * = 204;
  251.   objectNotFound           * = 205;
  252.   badStreamName            * = 206;
  253.   objectTooLarge           * = 207;
  254.   actionNotKnown           * = 209;
  255.   invalidComponentName     * = 210;
  256.   invalidLock              * = 211;
  257.   objectWrongType          * = 212;
  258.   diskNotValidated         * = 213;
  259.   diskWriteProtected       * = 214;
  260.   renameAcrossDevices      * = 215;
  261.   directoryNotEmpty        * = 216;
  262.   tooManyLevels            * = 217;
  263.   deviceNotMounted         * = 218;
  264.   seekError                * = 219;
  265.   commentTooBig            * = 220;
  266.   diskFull                 * = 221;
  267.   deleteProtected          * = 222;
  268.   writeProtected           * = 223;
  269.   readProtected            * = 224;
  270.   notADosDisk              * = 225;
  271.   noDisk                   * = 226;
  272.   noMoreEntries            * = 232;
  273. (* added for 1.4 *)
  274.   isSoftLink               * = 233;
  275.   objectLinked             * = 234;
  276.   badHunk                  * = 235;
  277.   notImplemented           * = 236;
  278.   recordNotLocked          * = 240;
  279.   lockCollision            * = 241;
  280.   lockTimeout              * = 242;
  281.   unlockError              * = 243;
  282.  
  283. (* error codes 303-305 are defined in dosasl.h *)
  284.  
  285. (* These are the return codes used by convention by AmigaDOS commands *)
  286. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  287.   ok                         * = 0;  (* No problems, success *)
  288.   warn                       * = 5;  (* A warning only *)
  289.   error                      * = 10;  (* Something wrong *)
  290.   fail                       * = 20;  (* Complete or severe failure*)
  291.  
  292. (* Bit numbers that signal you that a user has issued a break *)
  293.   ctrlC  * = 12;
  294.   ctrlD  * = 13;
  295.   ctrlE  * = 14;
  296.   ctrlF  * = 15;
  297.  
  298. (* Values returned by SameLock() *)
  299.   different         * = -1;
  300.   same              * = 0;
  301.   sameVolume        * = 1;       (* locks are on same volume *)
  302.   sameHandler       * = sameVolume;
  303. (* sameHandler was a misleading name, def kept for src compatibility *)
  304.  
  305. (* types for ChangeMode() *)
  306.   changeLock    * = 0;
  307.   changeFH      * = 1;
  308.  
  309. (* Values for MakeLink() *)
  310.   hard      * = 0;
  311.   soft      * = 1;       (* softlinks are not fully supported yet *)
  312.  
  313. (* values returned by ReadItem *)
  314.   equal     * = -2;              (* "=" Symbol *)
  315.   itemError * = -1;              (* error *)
  316.   nothing   * = 0;               (* *N, ;, endstreamch *)
  317.   unQuoted  * = 1;               (* unquoted item *)
  318.   quoted    * = 2;               (* quoted item *)
  319.  
  320. (* types for AllocDosObject/FreeDosObject *)
  321.   fileHandle         * = 0;       (* few people should use this *)
  322.   exAllControl       * = 1;       (* Must be used to allocate this! *)
  323.   fib                * = 2;       (* useful *)
  324.   stdPkt             * = 3;       (* for doing packet-level I/O *)
  325.   cli                * = 4;       (* for shell-writers, etc *)
  326.   rdArgs             * = 5;       (* for ReadArgs if you pass it in *)
  327.  
  328. (*
  329. **      $VER: datetime.h 36.7 (12.7.90)
  330. **
  331. **      Date and time header for AmigaDOS
  332. *)
  333.  
  334. (*
  335.  *      Data structures and equates used by the V1.4 DOS functions
  336.  * StrtoDate() and DatetoStr()
  337.  *)
  338.  
  339. CONST
  340.  
  341. (* You need this much room for each of the DateTime strings: *)
  342.   lenDatString  * = 16;
  343.  
  344. TYPE
  345.   DatString * = ARRAY lenDatString OF CHAR;
  346.   DatStringPtr * = POINTER TO DatString;
  347.  
  348. (* --------- String/Date structures etc *)
  349.   DateTime* = RECORD (DateBase)
  350.     stamp *  : Date;          (* DOS Date *)
  351.     format * : SHORTINT;      (* controls appearance of datStrDate *)
  352.     flags  * : s.SET8;        (* see BITDEF's below *)
  353.     strDay * : DatStringPtr;  (* day of the week string *)
  354.     strDate* : DatStringPtr;  (* date string *)
  355.     strTime* : DatStringPtr;  (* time string *)
  356.   END; (* DateTime *)
  357.  
  358. CONST
  359.  
  360. (*      flags for datFlags *)
  361.  
  362.   subst      * = 0;               (* substitute Today, Tomorrow, etc. *)
  363.   future     * = 1;               (* day of the week is in future *)
  364.  
  365. (*
  366.  *      date format values
  367.  *)
  368.  
  369.   formatDos     * = 0;               (* dd-mmm-yy *)
  370.   formatInt     * = 1;               (* yy-mm-dd  *)
  371.   formatUSA     * = 2;               (* mm-dd-yy  *)
  372.   formatCDN     * = 3;               (* dd-mm-yy  *)
  373.   formatMax     * = formatCDN;
  374.  
  375. (*
  376. **      $VER: dosasl.h 36.16 (2.5.91)
  377. **
  378. **      Pattern-matching structure definitions
  379. *)
  380.  
  381. (***********************************************************************
  382. ************************ PATTERN MATCHING ******************************
  383. ************************************************************************
  384.  
  385. * structure expected by MatchFirst, MatchNext.
  386. * Allocate this structure and initialize it as follows:
  387. *
  388. * Set apBreakBits to the signal bits (CDEF) that you want to take a
  389. * break on, or NULL, if you don't want to convenience the user.
  390. *
  391. * If you want to have the FULL PATH NAME of the files you found,
  392. * allocate a buffer at the END of this structure, and put the size of
  393. * it into apStrlen.  If you don't want the full path name, make sure
  394. * you set apStrlen to zero.  In this case, the name of the file, and stats
  395. * are available in the apInfo, as per usual.
  396. *
  397. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  398. * You should check the return value each time (see below) and take the
  399. * appropriate action, ultimately calling MatchEnd() when there are
  400. * no more files and you are done.  You can tell when you are done by
  401. * checking for the normal AmigaDOS return code errornomoreENTRIES.
  402. *
  403. *)
  404.  
  405. TYPE
  406.  
  407.   AnchorPath* = RECORD
  408.     base      * : AChainPtr;   (* pointer to first anchor *)
  409.     last      * : AChainPtr;   (* pointer to last anchor *)
  410.     breakBits * : s.SET32;     (* Bits we want to break on *)
  411.     foundBreak* : s.SET32;     (* Bits we broke on. Also returns errorBREAK *)
  412.     flags     * : s.SET8;      (* New use for extra word. *)
  413.     reserved  * : e.BYTE;
  414.     strlen    * : INTEGER;     (* This is what apLength used to be *)
  415.     info      * : FileInfoBlock;
  416.     buf       * : e.STRING;    (* Buffer for path name, allocated by user *)
  417.   END; (* AnchorPath *)
  418.  
  419.  
  420. CONST
  421.  
  422.   doWild     * = 0;       (* User option ALL *)
  423.   itsWild    * = 1;       (* Set by MatchFirst, used by MatchNext  *)
  424.                           (* Application can test apItsWild,  too  *)
  425.                           (* (means that there's a wildcard        *)
  426.                           (* in the pattern after calling          *)
  427.                           (* MatchFirst).                          *)
  428.   doDir      * = 2;       (* Bit is SET if a DIR node should be *)
  429.                           (* entered. Application can RESET this *)
  430.                           (* bit after MatchFirst/MatchNext to AVOID *)
  431.                           (* entering a dir. *)
  432.   didDir     * = 3;       (* Bit is SET for an "expired" dir node. *)
  433.   noMemErr   * = 4;       (* Set on memory error *)
  434.   doDot      * = 5;       (* If set, allow conversion of '.' to *)
  435.                           (* CurrentDir *)
  436.   dirChanged * = 6;       (* apcurrent->anLock changed *)
  437.                           (* since last MatchNext call *)
  438.   followHLinks* = 7;      (* follow hardlinks on DODIR - defaults   *)
  439.                           (* to not following hardlinks on a DODIR. *)
  440.  
  441. TYPE
  442.  
  443.   AChain* = RECORD
  444.     child  * : AChainPtr;
  445.     parent * : AChainPtr;
  446.     lock   * : FileLockPtr;
  447.     info   * : FileInfoBlock;
  448.     flags  * : s.SET8;
  449.     string * : e.STRING;
  450.   END; (* AChain *)
  451.  
  452. CONST
  453.  
  454.   patternBit * = 0;
  455.   examinedBit* = 1;
  456.   completed  * = 2;
  457.   allBit     * = 3;
  458.   single     * = 4;
  459.  
  460. (*
  461.  * Constants used by wildcard routines, these are the pre-parsed tokens
  462.  * referred to by pattern match.  It is not necessary for you to do
  463.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  464.  *)
  465.  
  466.   pAny          * = 80H;    (* Token for '*' or '#?  *)
  467.   pSingle       * = 81H;    (* Token for '?' *)
  468.   pOrStart      * = 82H;    (* Token for '(' *)
  469.   pOrNext       * = 83H;    (* Token for '|' *)
  470.   pOeEnd        * = 84H;    (* Token for ')' *)
  471.   pNot          * = 85H;    (* Token for '~' *)
  472.   pNotEnd       * = 86H;    (* Token for *)
  473.   pNotClass     * = 87H;    (* Token for '^' *)
  474.   pClass        * = 88H;    (* Token for '[]' *)
  475.   pRepBeg       * = 89H;    (* Token for '[' *)
  476.   pRepEnd       * = 8AH;    (* Token for ']' *)
  477.   pStop         * = 8BH;    (* token to force end of evaluation *)
  478.  
  479. (* Values for anStatus, NOTE: These are the actual bit numbers *)
  480.  
  481.   complexBit    * = 1;       (* Parsing complex pattern *)
  482.   examineBit    * = 2;       (* Searching directory *)
  483.  
  484. (*
  485.  * Returns from MatchFirst(), MatchNext()
  486.  * You can also get dos error returns, such as errornomoreENTRIES,
  487.  * these are in the dos.h file.
  488.  *)
  489.  
  490.   bufferOverflow  * = 303;     (* User or internal buffer overflow *)
  491.   break           * = 304;     (* A break character was received *)
  492.   notExecutable   * = 305;     (* A file has E bit cleared *)
  493.  
  494.  
  495. (*
  496. **      $VER: doshunks.h 36.9 (2.6.92)
  497. **
  498. **      Hunk definitions for object and load modules.
  499. *)
  500.  
  501. CONST
  502.  
  503. (* hunk types *)
  504.   hunkUnit      * = 999;
  505.   hunkName      * = 1000;
  506.   hunkCode      * = 1001;
  507.   hunkData      * = 1002;
  508.   hunkBSS       * = 1003;
  509.   hunkReloc32   * = 1004;
  510.   hunkAbsReloc32 * = hunkReloc32;
  511.   hunkReloc16   * = 1005;
  512.   hunkRelReloc16 * = hunkReloc16;
  513.   hunkReloc8    * = 1006;
  514.   hunkRelReloc8 * = hunkReloc8;
  515.   hunkExt       * = 1007;
  516.   hunkSymbol    * = 1008;
  517.   hunkDebug     * = 1009;
  518.   hunkEnd       * = 1010;
  519.   hunkHeader    * = 1011;
  520.  
  521.   hunkOverlay   * = 1013;
  522.   hunkBreak     * = 1014;
  523.  
  524.   hunkDRel32    * = 1015;
  525.   hunkDRel16    * = 1016;
  526.   hunkDRel8     * = 1017;
  527.  
  528.   hunkLib       * = 1018;
  529.   hunkIndex     * = 1019;
  530.  
  531. (*
  532.  * Nkte: V37 LoadSeg uses 1015 (hunkDRel32) by mistake.  This will continue
  533.  * to be supported in future versions, since hunkDRel32 is illegal in load files
  534.  * anyways.  Future versions will support both 1015 and 1020, though anything
  535.  * that should be usable under V37 should use 1015.
  536.  *)
  537.   hunkReloc32Short * = 1020;
  538.  
  539. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles relReloc32).*)
  540.   hunkRelReloc32 * = 1021;
  541.   hunkAbsReloc16 * = 1022;
  542.  
  543. (*
  544.  * Any hunks that have the hunkAdvisory bit set will be ignored if they
  545.  * aren't understood.  When ignored, they're treated like hunkDebug hunks.
  546.  * NOTE: this handling of hunkAdvisory started as of V39 dos.library!  If
  547.  * lading such executables is attempted under <V39 dos, it will fail with a
  548.  * bad hunk type.
  549.  *)
  550.   hunkAdvisory * = 29;
  551.   hunkChip * = 30;
  552.   hunkFast * = 31;
  553.  
  554.  
  555. (* hunkext sub-types *)
  556.   extSymb       * = 0;       (* symbol table *)
  557.   extDef        * = 1;       (* relocatable definition *)
  558.   extAbs        * = 2;       (* Absolute definition *)
  559.   extRes        * = 3;       (* no longer supported *)
  560.   extRef32      * = 129;     (* 32 bit reference to symbol *)
  561.   extAbsRef32   * = extRef32;
  562.   extCommon     * = 130;     (* 32 bit reference to COMMON block *)
  563.   extAbsCommon  * = extCommon;
  564.   extRef16      * = 131;     (* 16 bit reference to symbol *)
  565.   extRelRef16   * = extRef16;
  566.   extRef8       * = 132;     (*  8 bit reference to symbol *)
  567.   extRelRef8    * = extRef8;
  568.   extDExt32     * = 133;     (* 32 bit data releative reference *)
  569.   extDExt16     * = 134;     (* 16 bit data releative reference *)
  570.   extDExt8      * = 135;     (*  8 bit data releative reference *)
  571.  
  572. (* These are to support some of the '020 and up modes that are rarely used *)
  573.   extRelRef32   * = 136;     (* 32 bit PC-relative reference to symbol *)
  574.   extRelCommon  * = 137;     (* 32 bit PC-relative reference to COMMON block *)
  575.  
  576. (* for completeness... All 680x0's support this *)
  577.   extAbsRef16   * = 138;     (* 16 bit absolute reference to symbol *)
  578.  
  579. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  580.   extAbsRef8    * = 139;     (* 8 bit absolute reference to symbol *)
  581.  
  582.  
  583. (*
  584. **      $VER: filehandler.h 36.6 (9.8.92)
  585. **
  586. **      device and file handler specific code for AmigaDOS
  587. *)
  588.  
  589. TYPE
  590.  
  591. (* The disk "environment" is a longword array that describes the
  592.  * disk geometry.  It is variable sized, with the length at the beginning.
  593.  * Here are the constants for a standard geometry.
  594.  *)
  595.  
  596.   DosEnvec* = RECORD
  597.     tableSize     * : e.ULONG; (* Size of Environment vector *)
  598.     sizeBlock     * : e.ULONG; (* in longwords: standard value is 128 *)
  599.     secOrg        * : e.ULONG; (* not used; must be 0 *)
  600.     surfaces      * : e.ULONG; (* # of heads (surfaces). drive specific *)
  601.     sectorPerBlock* : e.ULONG; (* not used; must be 1 *)
  602.     blocksPerTrack* : e.ULONG; (* blocks per track. drive specific *)
  603.     reserved      * : e.ULONG; (* DOS reserved blocks at start of partition. *)
  604.     preAlloc      * : e.ULONG; (* DOS reserved blocks at end of partition *)
  605.     interleave    * : e.ULONG; (* usually 0 *)
  606.     lowCyl        * : e.ULONG; (* starting cylinder. typically 0 *)
  607.     highCyl       * : e.ULONG; (* max cylinder. drive specific *)
  608.     numBuffers    * : e.ULONG; (* Initial # DOS of buffers.  *)
  609.     bufMemType    * : e.ULONG; (* type of mem to allocate for buffers *)
  610.     maxTransfer   * : e.ULONG; (* Max number of bytes to transfer at a time *)
  611.     mask          * : s.SET32; (* Address Mask to block out certain memory *)
  612.     bootPri       * : LONGINT; (* Boot priority for autoboot *)
  613.     dosType       * : e.ULONG; (* ASCII (HEX) string showing filesystem type;
  614.                                 * 444F5300H is old filesystem,
  615.                                 * 444F5301H is fast file system *)
  616.     baud          * : e.ULONG; (* Baud rate for serial handler *)
  617.     control       * : e.ULONG; (* Control word for handler/filesystem *)
  618.     bootBlocks    * : e.ULONG; (* Number of blocks containing boot code *)
  619.  
  620.   END; (* DosEnvec *)
  621.  
  622. CONST
  623.  
  624. (* these are the offsets into the array *)
  625. (* deTableSize is set to the number of longwords in the table minus 1 *)
  626.  
  627.   tableSize   * = 0;       (* minimum value is 11 (includes NumBuffers) *)
  628.   sizeBlock   * = 1;       (* in longwords: standard value is 128 *)
  629.   secOrg      * = 2;       (* not used; must be 0 *)
  630.   numHeads    * = 3;       (* # of heads (surfaces). drive specific *)
  631.   secsPerBlk  * = 4;       (* not used; must be 1 *)
  632.   blksPerTrack* = 5;       (* blocks per track. drive specific *)
  633.   reservedBlks* = 6;       (* unavailable blocks at start.  usually 2 *)
  634.   prefac      * = 7;       (* not used; must be 0 *)
  635.   interleave  * = 8;       (* usually 0 *)
  636.   lowCyl      * = 9;       (* starting cylinder. typically 0 *)
  637.   upperCyl    * = 10;      (* max cylinder.  drive specific *)
  638.   numBuffers  * = 11;      (* starting # of buffers.  typically 5 *)
  639.   memBufType  * = 12;      (* type of mem to allocate for buffers. *)
  640.   bufMemType  * = 12;      (* same as above, better name
  641.                             * 1 is public, 3 is chip, 5 is fast *)
  642.   maxTransfer * = 13;      (* Max number bytes to transfer at a time *)
  643.   mask        * = 14;      (* Address Mask to block out certain memory *)
  644.   bootPri     * = 15;      (* Boot priority for autoboot *)
  645.   dosType     * = 16;      (* ASCII (HEX) string showing filesystem type;
  646.                             * 444F5300H is old filesystem,
  647.                             * 444F5301H is fast file system *)
  648.   baud        * = 17;      (* Baud rate for serial handler *)
  649.   control     * = 18;      (* Control word for handler/filesystem *)
  650.   bootBlocks  * = 19;      (* Number of blocks containing boot code *)
  651.  
  652. TYPE
  653.  
  654. (* The file system startup message is linked into a device node's startup
  655. ** field.  It contains a pointer to the above environment, plus the
  656. ** information needed to do an exec OpenDevice().
  657. *)
  658.   FileSysStartupMsg* = RECORD
  659.     unit   * : e.ULONG;     (* exec unit number for this device *)
  660.     device * : BSTR;        (* null terminated bstring to the device name *)
  661.     environ* : DosEnvecPtr; (* ptr to environment table (see above) *)
  662.     flags  * : s.SET32;     (* flags for OpenDevice() *)
  663.   END; (* FileSysStartupMsg *)
  664.  
  665.  
  666. (* The include file "libraries/dosextens.h" has a DeviceList structure.
  667.  * The "device list" can have one of three different things linked onto
  668.  * it.  Dosextens defines the structure for a volume.  dltDirectory
  669.  * is for an assigned directory.  The following structure is for
  670.  * a dos "device" (dltDevice).
  671. *)
  672.  
  673.   DeviceNode* = RECORD
  674.     next     * : DeviceNodePtr; (* singly linked list *)
  675.     type     * : e.ULONG;       (* always 0 for dos "devices" *)
  676.     task     * : ProcessId;     (* standard dos "task" field.  If this is
  677.                                  * null when the node is accesses, a task
  678.                                  * will be started up *)
  679.     lock     * : FileLockPtr;   (* not used for devices -- leave null *)
  680.     handler  * : BSTR;          (* filename to loadseg (if seglist is null) *)
  681.     stackSize* : e.ULONG;       (* stacksize to use when starting task *)
  682.     priority * : LONGINT;       (* task priority when starting task *)
  683.     startup  * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
  684.     segList  * : e.BPTR;        (* code to run to start new task (if necessary).
  685.                                  * if null then dnHandler will be loaded. *)
  686.     globalVec* : e.BPTR;        (* BCPL global vector to use when starting
  687.                                  * a task.  -1 means that dnSegList is not
  688.                                  * for a bcpl program, so the dos won't
  689.                                  * try and construct one.  0 tell the
  690.                                  * dos that you obey BCPL linkage rules,
  691.                                  * and that it should construct a global
  692.                                  * vector for you.
  693.                                  *)
  694.     name     * : BSTR;          (* the node name, e.g. '\3','D','F','3' *)
  695.   END; (* DeviceNode *)
  696.  
  697.  
  698. (*
  699. **      $VER: notify.h 36.8 (29.8.90)
  700. **
  701. **      dos notification definitions
  702. *)
  703.  
  704. CONST
  705.  
  706. (* use of Class and code is discouraged for the time being - we might want
  707.    to change things *)
  708. (* --- NotifyMessage Class ---------------------------------------------- *)
  709.   class   * = 40000000H;
  710.  
  711. (* --- NotifyMessage Codes ---------------------------------------------- *)
  712.   code    * = 1234H;
  713.  
  714. TYPE
  715.  
  716. (* Sent to the application if sendMESSAGE is specified.                    *)
  717.  
  718.   NotifyMessage* = RECORD (e.MessageBase)
  719.     execMessage * : e.Message;
  720.     class       * : e.ULONG;
  721.     code        * : e.UWORD;
  722.     nReq        * : NotifyRequestPtr; (* don't modify the request! *)
  723.     doNotTouch    : e.ULONG;          (* like it says!  For use by handlers *)
  724.     doNotTouch2   : e.ULONG;          (* ditto *)
  725.   END; (* NotifyMessage *)
  726.  
  727. (* Do not modify or reuse the notifyrequest while active.                 *)
  728. (* note: the first LONG of nrData has the length transfered               *)
  729.  
  730.   NotifyRequest* = RECORD
  731.     name    *  : e.LSTRPTR;
  732.     fullName*  : e.LSTRPTR;             (* set by dos - don't touch *)
  733.     userData*  : e.ULONG;              (* for applications use *)
  734.     flags   *  : s.SET32;
  735.     task    *  : e.TaskPtr;            (* for sendSignal *)
  736.     (** port * : e.MsgPortPtr;         (* for sendMessage *)
  737.      *
  738.      * port occupies the same space as task (a C union). Access via:
  739.      * SYS.VAL (e.MsgPortPtr, NotifyRequest.task)
  740.      *)
  741.     signalNum* : e.UBYTE;              (* for sendSignal *)
  742.     pad        : ARRAY 3 OF e.UBYTE;
  743.     reserved*  : ARRAY 4 OF e.ULONG;   (* leave 0 for now *)
  744.  
  745.     (* internal use by handlers *)
  746.     msgCount*  : e.ULONG;              (* # of outstanding msgs *)
  747.     handler *  : e.MsgPortPtr;         (* handler sent to (for EndNotify) *)
  748.   END; (* NotifyRequest *)
  749.  
  750. CONST
  751.  
  752. (* --- NotifyRequest Flags ------------------------------------------------ *)
  753.  
  754. (* bit numbers *)
  755.   sendMessage       * = 0;
  756.   sendSignal        * = 1;
  757.   waitReply         * = 3;
  758.   notifyInitial     * = 4;
  759.  
  760. (* do NOT set or remove nrMagic!  Only for use by handlers! *)
  761.   magic              * = 31;
  762.  
  763. (* Flags reserved for private use by the handler: *)
  764.   handlerFlags       * = {16 .. 31};
  765.  
  766.  
  767. (*
  768. **      $VER: rdargs.h 36.6 (12.7.90)
  769. **
  770. **      ReadArgs() structure definitions
  771. *)
  772.  
  773. (**********************************************************************
  774.  *
  775.  * The CSource data structure defines the input source for "ReadItem()"
  776.  * as well as the ReadArgs call.  It is a publicly defined structure
  777.  * which may be used by applications which use code that follows the
  778.  * conventions defined for access.
  779.  *
  780.  * When passed to the dos.library functions, the value passed as
  781.  * struct *CSource is defined as follows:
  782.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  783.  *      else                    Use CSource for input character stream
  784.  *
  785.  * The following two pseudo-code routines define how the CSource structure
  786.  * is used:
  787.  *
  788.  * long csReadChar( CSource : CSourcePtr )
  789.  * {
  790.  *      if ( CSource == 0 )     return ReadChar();
  791.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  792.  *      return CSource->Buffer[ CSource->CurChr++ ];
  793.  * }
  794.  *
  795.  * BOOL csUnReadChar( CSource : CSourcePtr )
  796.  * {
  797.  *      if ( CSource == 0 )     return UnReadChar();
  798.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  799.  *      CSource->CurChr--;
  800.  *      return TRUE;
  801.  * }
  802.  *
  803.  * To initialize a struct CSource, you set csource->csBuffer to
  804.  * a string which is used as the data source, and set csLength to
  805.  * the number of characters in the string.  Normally csCurChr should
  806.  * be initialized to ZERO, or left as it was from prior use as
  807.  * a CSource.
  808.  *
  809.  **********************************************************************)
  810.  
  811. TYPE
  812.  
  813.   CSource* = RECORD
  814.     buffer* : e.LSTRPTR;
  815.     length* : LONGINT;
  816.     curChr* : LONGINT;
  817.   END; (* CSource *)
  818.  
  819. (**********************************************************************
  820.  *
  821.  * The RDArgs data structure is the input parameter passed to the DOS
  822.  * ReadArgs() function call.
  823.  *
  824.  * The rdaSource structure is a CSource as defined above;
  825.  * if rdasource.csBuffer is non-null, rdaSource is used as the input
  826.  * character stream to parse, else the input comes from the buffered STDIN
  827.  * calls ReadChar/UnReadChar.
  828.  *
  829.  * rdaDAList is a private address which is used internally to track
  830.  * allocations which are freed by FreeArgs().  This MUST be initialized
  831.  * to NULL prior to the first call to ReadArgs().
  832.  *
  833.  * The rdaBuffer and rdaBufSiz fields allow the application to supply
  834.  * a fixed-size buffer in which to store the parsed data.  This allows
  835.  * the application to pre-allocate a buffer rather than requiring buffer
  836.  * space to be allocated.  If either rdaBuffer or rdaBufSiz is NULL,
  837.  * the application has not supplied a buffer.
  838.  *
  839.  * rdaExtHelp is a text string which will be displayed instead of the
  840.  * template string, if the user is prompted for input.
  841.  *
  842.  * rdaFlags bits control how ReadArgs() works.  The flag bits are
  843.  * defined below.  Defaults are initialized to ZERO.
  844.  *
  845.  **********************************************************************)
  846.  
  847. TYPE
  848.  
  849.   RDArgs* = RECORD
  850.     source * : CSource;     (* Select input source *)
  851.     daList * : LONGINT;     (* PRIVATE. *)
  852.     buffer * : e.LSTRPTR;   (* Optional string parsing space. *)
  853.     bufSiz * : LONGINT;     (* Size of rdaBuffer (0..n) *)
  854.     extHelp* : e.LSTRPTR;   (* Optional extended help *)
  855.     flags  * : s.SET32;     (* Flags for any required control *)
  856.   END; (* RDArgs *)
  857.  
  858. CONST
  859.  
  860.   stdIn     * = 0;       (* Use "STDIN" rather than "COMMAND LINE" *)
  861.   noAlloc   * = 1;       (* If set, do not allocate extra string space.*)
  862.   noPrompt  * = 2;       (* Disable reprompting for string input. *)
  863.  
  864. (**********************************************************************
  865.  * Maximum number of template keywords which can be in a template passed
  866.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  867.  **********************************************************************)
  868.   maxTemplateItems     * = 100;
  869.  
  870. (**********************************************************************
  871.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  872.  * an errorLineTooLONG.  These two limitations are due to stack
  873.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  874.  **********************************************************************)
  875.   maxMultiArgs          * = 128;
  876.  
  877.  
  878. (*
  879. **      $VER: record.h 36.5 (12.7.90)
  880. **
  881. **      include file for record locking
  882. *)
  883.  
  884. TYPE
  885. (*
  886.  * use an extension of this and pass it to ReadArgs()
  887.  * use one entry (see definitions below) for every template keyword
  888.  * according to it's type.
  889.  *)
  890.  
  891.   ArgsStruct * = RECORD END;
  892.  
  893.   ArgLong        * = POINTER TO ARRAY 1 OF LONGINT;   (* /N *)
  894.   ArgLongArray   * = POINTER TO ARRAY maxMultiArgs OF ArgLong;   (* /M/N*)
  895.   ArgBool        * = e.LONGBOOL;   (* /S, /T *)
  896.   ArgString      * = e.LSTRPTR;    (* /K, or nothing *)
  897.   ArgStringArray * = POINTER TO ARRAY maxMultiArgs OF ArgString; (* /K/M, /M *)
  898.  
  899.  
  900. CONST
  901.  
  902. (* Modes for LockRecord/LockRecords() *)
  903.   recExclusive         * = 0;
  904.   recExclusiveImmed    * = 1;
  905.   recShared            * = 2;
  906.   recSharedImmed       * = 3;
  907.  
  908. TYPE
  909.  
  910. (* struct to be passed to LockRecords()/UnLockRecords() *)
  911.  
  912.   RecordLock* = RECORD
  913.     fh    * : FileHandlePtr; (* filehandle *)
  914.     offset* : e.ULONG;       (* offset in file *)
  915.     length* : e.ULONG;       (* length of file to be locked *)
  916.     mode  * : e.ULONG;       (* Type of lock *)
  917.   END; (* RecordLock *)
  918.  
  919.  
  920. (*
  921. **      $VER: var.h 36.11 (2.6.92)
  922. **
  923. **      include file for dos local and environment variables
  924. *)
  925.  
  926. TYPE
  927.  
  928. (* the structure in the prLocalVars list *)
  929. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  930. (* future releases!  The list should be left in alphabetical order, and *)
  931. (* may have multiple entries with the same name but different types.    *)
  932.  
  933.   LocalVar* = RECORD (e.NodeBase)
  934.     node * : e.Node;
  935.     flags* : s.SET16;
  936.     value* : e.LSTRPTR;
  937.     len  * : e.ULONG;
  938.   END; (* LocalVar *)
  939.  
  940. CONST
  941.  
  942. (*
  943.  * The LocalVar.flags bits are available to the application.  The unused
  944.  * LocalVar.pri bits are reserved for system use.
  945.  *)
  946.  
  947. (* bit definitions for LocalVar.type: *)
  948.   var                 * = 0;       (* an variable *)
  949.   alias               * = 1;       (* an alias *)
  950. (* to be or'ed into LocalVar.type: *)
  951.   ignore              * = 7;       (* ignore this entry on GetVar, etc *)
  952.  
  953. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  954. (* bit defs to be OR'ed with the type: *)
  955. (* item will be treated as a single line of text unless binaryVAR is used *)
  956.   globalOnly        * = 8;
  957.   localOnly         * = 9;
  958.   binaryVar         * = 10;              (* treat variable as binary *)
  959.   dontNullTerm      * = 11;              (* only with gvBinaryVar *)
  960.  
  961. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  962. (* this causes SetVar to affect ENVARC: as well as ENV:.        *)
  963.   saveVar           * = 12;              (* only with gvGlobalVar *)
  964.  
  965.  
  966. (*
  967. **      $VER: dostags.h 36.11 (29.4.91)
  968. **
  969. **      Tag definitions for all Dos routines using tags
  970. *)
  971.  
  972. CONST
  973.  
  974. (*****************************************************************************)
  975. (* definitions for the System() call *)
  976.  
  977.   sysDummy      * = u.user + 32;
  978.   sysInput      * = sysDummy + 1; (* specifies the input filehandle  *)
  979.   sysOutput     * = sysDummy + 2; (* specifies the output filehandle *)
  980.   sysAsynch     * = sysDummy + 3; (* run asynch, close input/output on exit(!) *)
  981.   sysUserShell  * = sysDummy + 4; (* send to user shell instead of boot shell *)
  982.   sysCustomShell* = sysDummy + 5; (* send to a specific shell (data is name) *)
  983.  
  984. (*****************************************************************************)
  985. (* definitions for the CreateNewProc() call *)
  986. (* you MUST specify one of npSeglist or npEntry.  All else is optional. *)
  987.  
  988.   npDummy       * = u.user + 1000;
  989.   npSeglist     * = npDummy + 1; (* seglist of code to run for the process  *)
  990.   npFreeSeglist * = npDummy + 2; (* free seglist on exit - only valid for   *)
  991.                                  (* for npSeglist.  Default is TRUe.       *)
  992.   npEntry       * = npDummy + 3; (* entry point to run - mutually exclusive *)
  993.                                  (* with npSeglist! *)
  994.   npInput       * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
  995.   npOutput      * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
  996.   npCloseInput  * = npDummy + 6; (* close input filehandle on exit          *)
  997.                                  (* default TRUE                            *)
  998.   npCloseOutput * = npDummy + 7; (* close output filehandle on exit         *)
  999.                                  (* default TRUE                            *)
  1000.   npError       * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
  1001.   npCloseError  * = npDummy + 9; (* close error filehandle on exit          *)
  1002.                                  (* default TRUE                            *)
  1003.   npCurrentDir  * = npDummy + 10; (* lock - default is parent's current dir  *)
  1004.   npStackSize   * = npDummy + 11; (* stacksize for process - default 4000    *)
  1005.   npName        * = npDummy + 12; (* name for process - default "New Process"*)
  1006.   npPriority    * = npDummy + 13; (* priority - default same as parent       *)
  1007.   npConsoleTask * = npDummy + 14; (* consoletask - default same as parent    *)
  1008.   npWindowPtr   * = npDummy + 15; (* window ptr - default is same as parent  *)
  1009.   npHomeDir     * = npDummy + 16; (* home directory - default curr home dir  *)
  1010.   npCopyVars    * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
  1011.   npCli         * = npDummy + 18; (* create cli structure - default FALSE    *)
  1012.   npPath        * = npDummy + 19; (* path - default is copy of parents path  *)
  1013.                                   (* only valid if a cli process!    *)
  1014.   npCommandName * = npDummy + 20; (* commandname - valid only for CLI        *)
  1015.   npArguments   * = npDummy + 21; (* cstring of arguments - passed with str in a0, length in d0.  *)
  1016.                                   (* (copied and freed on exit.)  Default is 0-length NULL ptr.   *)
  1017.                                   (* NOTE: not operational until V37 - see BIX/TechNotes for      *)
  1018.                                   (* more info/workaround.  In V36, the registers were random.    *)
  1019.                                   (* You must NEVER use npArguments with a npInput of NULL.       *)
  1020. (* FIX! should this be only for cli's? *)
  1021.   npNotifyOnDeath* = npDummy + 22; (* notify parent on death - default FALSE  *)
  1022.                                    (* Not functional yet. *)
  1023.   npSynchronous * = npDummy + 23; (* don't return until process finishes -   *)
  1024.                                   (* default FALSe.                          *)
  1025.                                   (* Not functional yet. *)
  1026.   npExitCode    * = npDummy + 24; (* code to be called on process exit       *)
  1027.   npExitData    * = npDummy + 25; (* optional argument for npEndCode rtn -  *)
  1028.                                   (* default NULL                           *)
  1029.  
  1030.  
  1031. (*****************************************************************************)
  1032. (* tags for AllocDosObject *)
  1033.  
  1034.   adoDummy     * = u.user + 2000;
  1035.   adoFHMode    * = adoDummy + 1;
  1036.                               (* for type dosFILEHANDLE only            *)
  1037.                               (* sets up FH for mode specified.
  1038.                                  This can make a big difference for buffered
  1039.                                  files.                                  *)
  1040.        (* The following are for dosCLI *)
  1041.        (* If you do not specify these, dos will use it's preferred values *)
  1042.        (* which may change from release to release.  The BPTRs to these   *)
  1043.        (* will be set up correctly for you.  Everything will be zero,     *)
  1044.        (* except cliFailLevel (10) and cliBackground (DOSTRUE).           *)
  1045.        (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  1046.  
  1047.   adoDirLen     * = adoDummy + 2; (* size in bytes for current dir buffer    *)
  1048.   adoCommNameLen* = adoDummy + 3; (* size in bytes for command name buffer   *)
  1049.   adoCommFileLen* = adoDummy + 4; (* size in bytes for command file buffer   *)
  1050.   adoPromptLen  * = adoDummy + 5; (* size in bytes for the prompt buffer     *)
  1051.  
  1052. (*****************************************************************************)
  1053. (* tags for NewLoadSeg *)
  1054. (* no tags are defined yet for NewLoadSeg *)
  1055.  
  1056.  
  1057. (*
  1058. **      $VER: exall.h 36.6 (5.4.92)
  1059. **
  1060. **      include file for ExAll() data structures
  1061. *)
  1062.  
  1063. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  1064. (* will return an error if passed edOwner.  If you get errorBadNumber,    *)
  1065. (* retry with edComment to get everything but owner info.  All filesystems  *)
  1066. (* supporting ExAll() must support through edComment, and must check Type   *)
  1067. (* and return errorBadNumber if they don't support the type.               *)
  1068.  
  1069. CONST
  1070.  
  1071. (* values that can be passed for what data you want from ExAll() *)
  1072. (* each higher value includes those below it (numerically)       *)
  1073. (* you MUST chose one of these values *)
  1074.   name        * = 1;
  1075.   type        * = 2;
  1076.   size        * = 3;
  1077.   protection  * = 4;
  1078.   date        * = 5;
  1079.   comment     * = 6;
  1080.   owner       * = 7;
  1081.  
  1082. TYPE
  1083.  
  1084. (*
  1085.  *   Structure in which exall results are returned in.  Note that only the
  1086.  *   fields asked for will exist!
  1087.  *)
  1088.  
  1089.   ExAllData* = RECORD
  1090.     next     * : ExAllDataPtr;
  1091.     name     * : e.LSTRPTR;
  1092.     type     * : LONGINT;
  1093.     size     * : e.ULONG;
  1094.     prot     * : s.SET32;
  1095.     days     * : e.ULONG;
  1096.     mins     * : e.ULONG;
  1097.     ticks    * : e.ULONG;
  1098.     comment  * : e.LSTRPTR;     (* strings will be after last used field *)
  1099.     ownerUID * : e.UWORD;      (* new for V39 *)
  1100.     ownerGID * : e.UWORD;
  1101.   END; (* ExAllData *)
  1102.  
  1103. (*
  1104.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1105.  *   0, expecially eacLastKey.
  1106.  *
  1107.  *   eacMatchFunc is a hook (see utility.library documentation for usage)
  1108.  *   It should return true if the entry is to returned, false if it is to be
  1109.  *   ignored.
  1110.  *
  1111.  *   This structure MUST be allocated by AllocDosObject()!
  1112.  *)
  1113.  
  1114.   ExAllControl* = RECORD
  1115.     entries    * : e.ULONG;   (* number of entries returned in buffer      *)
  1116.     lastKey    * : e.ULONG;   (* Don't touch inbetween linked ExAll calls! *)
  1117.     matchString* : e.LSTRPTR; (* wildcard string for pattern match or NULL *)
  1118.     matchFunc  * : u.HookPtr; (* optional private wildcard function     *)
  1119.   END; (* ExAllControl *)
  1120.  
  1121. (*
  1122. **      $VER: dosextens.h 36.41 (14.5.92)
  1123. **
  1124. **      DOS structures not needed for the casual AmigaDOS user
  1125. *)
  1126.  
  1127. TYPE
  1128.  
  1129. (* All DOS processes have this structure *)
  1130. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  1131. (* devproc* = (DeviceProc(..) - SIZE (Task)); *)
  1132.  
  1133.   Process* = RECORD (e.TaskBase)
  1134.     task          * : e.Task;
  1135.     msgPort       * : e.MsgPort;     (* This is BPTR address from DOS functions  *)
  1136.     pad           * : INTEGER;       (* Remaining variables on 4 byte boundaries *)
  1137.     segList       * : e.BPTR;          (* Array of seg lists used by this process  *)
  1138.     stackSize     * : LONGINT;       (* Size of process stack in bytes           *)
  1139.     globVec       * : e.APTR;        (* Global vector for this process (BCPL)    *)
  1140.     taskNum       * : LONGINT;       (* CLI task number of zero if not a CLI     *)
  1141.     stackBase     * : e.BPTR;          (* Ptr to high memory end of process stack  *)
  1142.     result2       * : LONGINT;       (* Value of secondary result from last call *)
  1143.     currentDir    * : FileLockPtr;   (* Lock associated with current directory   *)
  1144.     cis           * : FileHandlePtr; (* Current CLI Input Stream                 *)
  1145.     cos           * : FileHandlePtr; (* Current CLI Output Stream                *)
  1146.     consoleTask   * : ProcessId;     (* Console handler process for current window*)
  1147.     fileSystemTask* : ProcessId;     (* File handler process for current drive   *)
  1148.     cli           * : CommandLineInterfacePtr;
  1149.                                      (* pointer to CommandLineInterface          *)
  1150.     returnAddr    * : e.APTR;        (* pointer to previous stack frame          *)
  1151.     pktWait       * : e.APTR;        (* Function to be called when awaiting msg  *)
  1152.     windowPtr     * : e.APTR;        (* Window for error printing                *)
  1153.  
  1154.     (* following definitions are new with 2.0 *)
  1155.     homeDir       * : FileLockPtr;   (* Home directory of executing program      *)
  1156.     flags         * : s.SET32;       (* flags telling dos about process          *)
  1157.     exitCode      * : e.PROC;        (* code to call on exit of program or NULL  *)
  1158.     exitData      * : LONGINT;       (* Passed as an argument to prExitCode.     *)
  1159.     arguments     * : e.LSTRPTR;     (* Arguments passed to the process at start *)
  1160.     localVars     * : e.MinList;     (* Local environment variables              *)
  1161.     shellPrivate  * : e.ULONG;       (* for the use of the current shell         *)
  1162.     ces           * : FileHandlePtr; (* Error stream - if NULL, use prCOS        *)
  1163.   END; (* Process *)
  1164.  
  1165. CONST
  1166.  
  1167. (*
  1168.  * Flags for Process.prFlags
  1169.  *)
  1170.   freeSegList        * = 0;
  1171.   freeCurrDir        * = 1;
  1172.   freeCli            * = 2;
  1173.   closeInput         * = 3;
  1174.   closeOutput        * = 4;
  1175.   freeArgs           * = 5;
  1176.  
  1177. TYPE
  1178.  
  1179. (* The long word address (BPTR) of this structure is returned by
  1180.  * Open() and other routines that return a file.  You need only worry
  1181.  * about this struct to do async io's via PutMsg() instead of
  1182.  * standard file system calls *)
  1183.  
  1184.   FileHandle* = RECORD
  1185.     link  * : e.MessagePtr; (* EXEC message              *)
  1186.     port  * : e.MsgPortPtr; (* Reply port for the packet *)
  1187.     type  * : ProcessId;    (* Port to do PutMsg() to
  1188.                              * Address is negative if a plain file *)
  1189.     buf   * : LONGINT;
  1190.     pos   * : LONGINT;
  1191.     end   * : LONGINT;
  1192.     func1 * : LONGINT;
  1193.     func2 * : LONGINT;
  1194.     func3 * : LONGINT;
  1195.     arg1  * : LONGINT;
  1196.     arg2  * : LONGINT;
  1197.   END; (* FileHandle *)
  1198.  
  1199. (* This is the extension to EXEC Messages used by DOS *)
  1200.  
  1201.   DosPacket* = RECORD
  1202.     link* : e.MessagePtr;     (* EXEC message              *)
  1203.     port* : e.MsgPortPtr;     (* Reply port for the packet *)
  1204.                               (* Must be filled in each send. *)
  1205.     type* : LONGINT;          (* See action... below and
  1206.                                * 'R' means Read, 'W' means Write to the
  1207.                                * file system *)
  1208.     res1* : LONGINT;          (* For file system calls this is the result
  1209.                                * that would have been returned by the
  1210.                                * function, e.g. Write ('W') returns actual
  1211.                                * length written *)
  1212.     res2* : LONGINT;          (* For file system calls this is what would
  1213.                                * have been returned by IoErr() *)
  1214.     arg1* : LONGINT;
  1215.     arg2* : LONGINT;
  1216.     arg3* : LONGINT;
  1217.     arg4* : LONGINT;
  1218.     arg5* : LONGINT;
  1219.     arg6* : LONGINT;
  1220.     arg7* : LONGINT;
  1221.   END; (* DosPacket *)
  1222.  
  1223. (* A Packet does not require the Message to be before it in memory, but
  1224.  * for convenience it is useful to associate the two.
  1225.  * Also see the function initstdpkt for initializing this structure *)
  1226.  
  1227.   StandardPacket* = RECORD (e.MessageBase)
  1228.     msg * : e.Message;
  1229.     pkt * : DosPacket;
  1230.   END; (* StandardPacket *)
  1231.  
  1232. CONST
  1233.  
  1234. (* DosPacket types *)
  1235.   nil             * = 0;
  1236.   startup         * = 0;
  1237.   getBlock        * = 2;       (* OBSOLETE *)
  1238.   setMap          * = 4;
  1239.   die             * = 5;
  1240.   event           * = 6;
  1241.   currentVolume   * = 7;
  1242.   locateObject    * = 8;
  1243.   renameDisk      * = 9;
  1244.   write           * = ORD ("W");
  1245.   read            * = ORD ("R");
  1246.   freeLock        * = 15;
  1247.   deleteObject    * = 16;
  1248.   renameObject    * = 17;
  1249.   moreCache       * = 18;
  1250.   copyDir         * = 19;
  1251.   waitChar        * = 20;
  1252.   setProtect      * = 21;
  1253.   createDir       * = 22;
  1254.   examineObject   * = 23;
  1255.   examineNext     * = 24;
  1256.   diskInfo        * = 25;
  1257.   info            * = 26;
  1258.   flush           * = 27;
  1259.   setComment      * = 28;
  1260.   parent          * = 29;
  1261.   timer           * = 30;
  1262.   inhibit         * = 31;
  1263.   diskType        * = 32;
  1264.   diskChange      * = 33;
  1265.   setDate         * = 34;
  1266.  
  1267.   screenMode      * = 994;
  1268.  
  1269.   readReturn      * = 1001;
  1270.   writeReturn     * = 1002;
  1271.   seek            * = 1008;
  1272.   findUpdate      * = 1004;
  1273.   findInput       * = 1005;
  1274.   findOutput      * = 1006;
  1275.   actionEnd       * = 1007;
  1276.   setFileSize     * = 1022;    (* fast file system only in 1.3 *)
  1277.   writeprotect    * = 1023;    (* fast file system only in 1.3 *)
  1278.  
  1279. (* new 2.0 packets *)
  1280.   sameLock       * = 40;
  1281.   changeSignal   * = 995;
  1282.   format         * = 1020;
  1283.   makeLink       * = 1021;
  1284.  
  1285.   readLink       * = 1024;
  1286.   fhFromLock     * = 1026;
  1287.   isFileSystem   * = 1027;
  1288.   changeMode     * = 1028;
  1289.  
  1290.   copyDirFH      * = 1030;
  1291.   parentFH       * = 1031;
  1292.   examineAll     * = 1033;
  1293.   examineFH      * = 1034;
  1294.  
  1295.   lockRecord     * = 2008;
  1296.   freeRecord     * = 2009;
  1297.  
  1298.   addNotify      * = 4097;
  1299.   removeNotify   * = 4098;
  1300.  
  1301. (* Added in V39: *)
  1302.   examineAllEnd  * = 1035;
  1303.   setOwner       * = 1036;
  1304.  
  1305. (* Tell a file system to serialize the current volume. This is typically
  1306.  * done by changing the creation date of the disk. This packet does not take
  1307.  * any arguments.  NOTE: be prepared to handle failure of this packet for
  1308.  * V37 ROM filesystems.
  1309.  *)
  1310.   serializeDisk  * = 4200;
  1311.  
  1312. TYPE
  1313.  
  1314. (*
  1315.  * A structure for holding error messages - stored as array with error = 0
  1316.  * for the last entry.
  1317.  *)
  1318.   ErrorString* = RECORD
  1319.     nums   * : e.APTR;
  1320.     strings* : e.APTR;
  1321.   END; (* ErrorString *)
  1322.  
  1323. (* DOS library node structure.
  1324.  * This is the data at positive offsets from the library node.
  1325.  * Negative offsets from the node is the jump table to DOS functions
  1326.  * node = OpenLibrary( "dos.library" .. )      *)
  1327.  
  1328.   DosLibrary* = RECORD (e.LibraryBase)
  1329.     lib         * : e.Library;
  1330.     root        * : RootNodePtr;      (* Pointer to RootNode, described below *)
  1331.     gv          * : e.APTR;           (* Pointer to BCPL global vector        *)
  1332.     a2            : LONGINT;          (* BCPL standard register values        *)
  1333.     a5            : LONGINT;
  1334.     a6            : LONGINT;
  1335.     errors      * : ErrorStringPtr;   (* PRIVATE pointer to array of error msgs *)
  1336.     timeReq       : t.TimeRequestPtr; (* PRIVATE pointer to timer request *)
  1337.     utilityBase   : e.LibraryPtr;     (* PRIVATE ptr to utility library *)
  1338.     intuitionBase : e.LibraryPtr      (* PRIVATE ptr to intuition library *)
  1339.   END; (* DosLibrary *)
  1340.  
  1341.   TaskArray* = RECORD
  1342.     maxCLI * : LONGINT;
  1343.     cli    * : ARRAY 32767 OF ProcessId;
  1344.   END; (* TaskArray *)
  1345.  
  1346.   RootNode* = RECORD
  1347.     taskArray     * : TaskArrayPtr; (* [0] is max number of CLI's
  1348.                                      * [1] is APTR to process id of CLI 1
  1349.                                      * [n] is APTR to process id of CLI n *)
  1350.     consoleSegment* : e.BPTR;         (* SegList for the CLI                      *)
  1351.     time          * : Date;         (* Current time                        *)
  1352.     restartSeg    * : e.BPTR;         (* SegList for the disk validator process   *)
  1353.     info          * : DosInfoPtr;   (* Pointer to the Info structure            *)
  1354.     fileHandlerSegment* : e.BPTR;     (* segment for a file handler               *)
  1355.     cliList       * : e.MinList;    (* new list of all CLI processes *)
  1356.                                     (* the first cplArray is also rnTaskArray   *)
  1357.     bootProc      * : ProcessId;    (* private ptr to msgport of boot fs        *)
  1358.     shellSegment  * : e.BPTR;         (* seglist for Shell (for NewShell)         *)
  1359.     flags         * : s.SET32;      (* dos flags *)
  1360.   END; (* RootNode *)
  1361.  
  1362. CONST
  1363.  
  1364.   wildStar   * = 24;
  1365.   private1     = 1;       (* private for dos *)
  1366.  
  1367. TYPE
  1368.  
  1369. (* ONLY to be allocated by DOS! *)
  1370.   CliProcList* = RECORD (e.MinNodeBase)
  1371.     node * : e.MinNode;
  1372.     first* : LONGINT;    (* number of first entry in array *)
  1373.     array* : POINTER TO ARRAY 32767 OF ProcessId;
  1374.                          (* [0] is max number of CLI's in this entry (n)
  1375.                           * [1] is CPTR to process id of CLI cplFirst
  1376.                           * [n] is CPTR to process id of CLI cplFirst+n-1
  1377.                           *)
  1378.   END; (* CliProcList *)
  1379.  
  1380.   DosInfo* = RECORD
  1381.     mcName    * : e.BPTR;       (* PRIVATE: system resident module list      *)
  1382.     devInfo   * : DevInfoPtr; (* Device List                               *)
  1383.     devices   * : e.BPTR;     (* Currently zero                            *)
  1384.     handlers  * : e.BPTR;     (* Currently zero                            *)
  1385.     netHand   * : ProcessId;  (* Network handler processid; currently zero *)
  1386.     devLock   * : e.SignalSemaphore; (* do NOT access directly! *)
  1387.     entryLock * : e.SignalSemaphore; (* do NOT access directly! *)
  1388.     deleteLock* : e.SignalSemaphore; (* do NOT access directly! *)
  1389.   END; (* DosInfo *)  (* DosInfo *)
  1390.  
  1391. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  1392. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  1393.  
  1394.   Segment* = RECORD
  1395.     next* : e.BPTR;
  1396.     uc  * : LONGINT;
  1397.     seg * : e.BPTR;
  1398.     name* : ARRAY 4 OF CHAR; (* actually the first 4 chars of BSTR name *)
  1399.   END; (* Segment *)
  1400.  
  1401. CONST
  1402.  
  1403.   cmdSystem     * = -1;
  1404.   cmdInternal   * = -2;
  1405.   cmdDisabled   * = -999;
  1406.  
  1407. TYPE
  1408.  
  1409.   PathLockPtr * = POINTER TO PathLock;
  1410.   PathLock * = RECORD
  1411.     next * : PathLockPtr;
  1412.     lock * : FileLockPtr;
  1413.   END; (* PathLock *)
  1414.  
  1415.  
  1416. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  1417.  * set to data associated with them *)
  1418.  
  1419.   CommandLineInterface* = RECORD
  1420.     result2       * : LONGINT;       (* Value of IoErr from last command        *)
  1421.     setName       * : BSTR;          (* Name of current directory               *)
  1422.     commandDir    * : PathLockPtr;   (* Head of the path locklist               *)
  1423.     returnCode    * : LONGINT;       (* Return code from last command           *)
  1424.     commandName   * : BSTR;          (* Name of current command                 *)
  1425.     failLevel     * : LONGINT;       (* Fail level (set by FAILAT)              *)
  1426.     prompt        * : BSTR;          (* Current prompt (set by PROMPT)          *)
  1427.     standardInput * : FileHandlePtr; (* Default (terminal) CLI input            *)
  1428.     currentInput  * : FileHandlePtr; (* Current CLI input                       *)
  1429.     commandFile   * : BSTR;          (* Name of EXECUTE command file            *)
  1430.     interactive   * : LONGINT;       (* Boolean; True if prompts required       *)
  1431.     background    * : LONGINT;       (* Boolean; True if CLI created by RUN     *)
  1432.     currentOutput * : FileHandlePtr; (* Current CLI output                      *)
  1433.     defaultStack  * : LONGINT;       (* Stack size to be obtained in long words *)
  1434.     standardOutput* : FileHandlePtr; (* Default (terminal) CLI output           *)
  1435.     module        * : e.BPTR;          (* SegList of currently loaded command     *)
  1436.   END; (* CommandLineInterface *)
  1437.   CommandLineInterfaceAPtr* = POINTER TO CommandLineInterface;
  1438.  
  1439. (* This structure can take on different values depending on whether it is
  1440.  * a device, an assigned directory, or a volume.  Below is the structure
  1441.  * reflecting volumes only.  Following that is the structure representing
  1442.  * only devices. Following that is the unioned structure representing all
  1443.  * the values
  1444.  *)
  1445.  
  1446.   DosListNode * = RECORD END;
  1447.  
  1448. (* structure representing a volume *)
  1449.  
  1450.   DeviceList* = RECORD (DosListNode)
  1451.     next      * : DeviceListPtr; (* bptr to next device list *)
  1452.     type      * : LONGINT;       (* see DLT below *)
  1453.     task      * : ProcessId;     (* ptr to handler task *)
  1454.     lock      * : FileLockPtr;   (* not for volumes *)
  1455.     volumeDate* : Date;          (* creation date *)
  1456.     lockList  * : FileLockPtr;   (* outstanding locks *)
  1457.     diskType  * : LONGINT;       (* 'DOS', etc *)
  1458.     unused    * : LONGINT;
  1459.     name      * : BSTR;          (* bptr to bcpl name *)
  1460.   END; (* DeviceList *)
  1461.   DeviceListAPtr*           = POINTER TO DeviceList;
  1462.  
  1463. (* device structure (same as the DeviceNode structure in filehandler.h) *)
  1464.  
  1465.   DevInfo* = RECORD (DosListNode)
  1466.     next     * : DevInfoPtr;
  1467.     type     * : LONGINT;
  1468.     task     * : ProcessId;
  1469.     lock     * : FileLockPtr;
  1470.     handler  * : BSTR;
  1471.     stackSize* : LONGINT;
  1472.     priority * : LONGINT;
  1473.     startup  * : FileSysStartupMsgPtr;
  1474.     segList  * : e.BPTR;
  1475.     globVec  * : e.BPTR;
  1476.     name     * : BSTR;
  1477.   END; (* DevInfo *)
  1478.   DevInfoAPtr*              = POINTER TO DevInfo;
  1479.  
  1480. (* structure used for multi-directory assigns. AllocVec()ed. *)
  1481.  
  1482.   AssignList* = RECORD
  1483.     next* : AssignListPtr;
  1484.     lock* : FileLockPtr;
  1485.   END; (* AssignList *)
  1486.  
  1487. (* combined structure for devices, assigned directories, volumes *)
  1488.  
  1489.   DosList* = RECORD (DosListNode)
  1490.     next      * : DevInfoPtr;      (* bptr to next device on list *)
  1491.     type      * : LONGINT;         (* see DLT below *)
  1492.     task      * : ProcessId;       (* ptr to handler task *)
  1493.     lock      * : FileLockPtr;
  1494.     assignName* : e.LSTRPTR;       (* name for non-or-late-binding assign *)
  1495.     list      * : AssignListPtr;   (* for multi-directory assigns (regular) *)
  1496.     unused    * : ARRAY 4 OF LONGINT;
  1497.  
  1498.     name      * : BSTR;            (* bptr to bcpl name *)
  1499.   END; (* DosList *)
  1500.   DosListAPtr*              = POINTER TO DosList;
  1501.  
  1502. CONST
  1503.  
  1504. (* definitions for DosList.type *)
  1505.   device     * = 0;
  1506.   directory  * = 1;       (* assign *)
  1507.   volume     * = 2;
  1508.   late       * = 3;       (* late-binding assign *)
  1509.   nonBinding * = 4;       (* non-binding assign *)
  1510.   private    * = -1;      (* for internal use only *)
  1511.  
  1512. TYPE
  1513.  
  1514. (* structure return by GetDeviceProc() *)
  1515.   DevProc* = RECORD
  1516.     port   * : e.MsgPortPtr;
  1517.     lock   * : FileLockPtr;
  1518.     flags  * : s.SET32;
  1519.     devNode  : DosListNodePtr;    (* DON'T TOUCH OR USE! *)
  1520.   END; (* DevProc *)
  1521.  
  1522. CONST
  1523.  
  1524. (* definitions for DevProc.flags *)
  1525.   unLock    * = 0;
  1526.   assign    * = 1;
  1527.  
  1528. (* Flags to be passed to LockDosList(), etc *)
  1529.   devices    * = 2;
  1530.   volumes    * = 3;
  1531.   assigns    * = 4;
  1532.   entry      * = 5;
  1533.   ldDelete   * = 6;
  1534.  
  1535. (* you MUST specify one of read or write *)
  1536.   dosListRead  * = 0;
  1537.   dosListWrite * = 1;
  1538.  
  1539. (* actually all but ldEntry (which is used for internal locking) *)
  1540.   all        * = {devices, volumes, assigns};
  1541.  
  1542. TYPE
  1543.  
  1544. (* a lock structure, as returned by Lock() or DupLock() *)
  1545.   FileLock* = RECORD
  1546.     link  * : FileLockPtr;     (* bcpl pointer to next lock *)
  1547.     key   * : LONGINT;         (* disk block number *)
  1548.     access* : LONGINT;         (* exclusive or shared *)
  1549.     task  * : ProcessId;       (* handler task's port *)
  1550.     volume* : DeviceListPtr;   (* bptr to dltVOLUME DosList entry *)
  1551.   END; (* FileLock *)
  1552.  
  1553. CONST
  1554.  
  1555. (* error report types for ErrorReport() *)
  1556.   reportStream          * = 0;       (* a stream *)
  1557.   reportTask            * = 1;       (* a process - unused *)
  1558.   reportLock            * = 2;       (* a lock *)
  1559.   reportVolume          * = 3;       (* a volume node *)
  1560.   reportInsert          * = 4;       (* please insert volume *)
  1561.  
  1562. (* Special error codes for ErrorReport() *)
  1563.   diskError             * = 296;     (* Read/write error *)
  1564.   abortBusy             * = 288;     (* You MUST replace... *)
  1565.  
  1566. (* types for initial packets to shells from run/newcli/execute/system. *)
  1567. (* For shell-writers only *)
  1568.   runExecute            * = -1;
  1569.   runSystem             * = -2;
  1570.   runSystemAsynch       * = -3;
  1571.  
  1572. (* Types for fibDirEntryType.  NOTE that both USERDIR and ROOT are      *)
  1573. (* directories, and that directory/file checks should use <0 and >=0.    *)
  1574. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  1575. (* values as needed, though <0 and >=0 should remain as supported as     *)
  1576. (* possible.                                                             *)
  1577.   root        * = 1;
  1578.   userDir     * = 2;
  1579.   softLink    * = 3;       (* looks like dir, but may point to a file! *)
  1580.   linkDir     * = 4;       (* hard link to dir *)
  1581.   file        * = -3;      (* must be negative for FIB! *)
  1582.   linkFile    * = -4;      (* hard link to file *)
  1583.   pipeFile    * = -5;      (* for pipes that(s}pport ExamineFH *)
  1584.  
  1585. (*
  1586. **      $VER: stdio.h 36.6 (1.11.91)
  1587. **
  1588. **      ANSI-like stdio defines for dos buffered I/O
  1589. *)
  1590.  
  1591. CONST
  1592.  
  1593. (* types for SetVBuf *)
  1594.   bufLine * = 0;                (* flush on \n, etc *)
  1595.   bufFull * = 1;                (* never flush except when needed *)
  1596.   bufNone * = 2;                (* no buffering *)
  1597.  
  1598. (* EOF return value *)
  1599.   endStreamCh * = -1;
  1600.  
  1601.  
  1602. (**-- Library Base variable --------------------------------------------*)
  1603.  
  1604. VAR
  1605.  
  1606.   base* : DosLibraryPtr;
  1607.  
  1608.  
  1609. (**-- Library Functions ------------------------------------------------*)
  1610.  
  1611. TYPE
  1612.   OwnerInfo * = RECORD (* dummy for better access on SetOwner etc.*)
  1613.     uid *: INTEGER;
  1614.     gid *: INTEGER;
  1615.   END;
  1616.  
  1617. (*
  1618. **      $VER: dos_protos.h 36.31 (17.12.92)
  1619. *)
  1620.  
  1621.  
  1622. PROCEDURE Open* [base,-30]
  1623.   ( name       [1] : ARRAY OF CHAR;
  1624.     accessMode [2] : LONGINT)
  1625.   : FileHandlePtr;
  1626. PROCEDURE Close* [base,-36]
  1627.   ( file [1] : FileHandlePtr )
  1628.   : BOOLEAN;
  1629. PROCEDURE OldClose* [base,-36]
  1630.   ( file [1] : FileHandlePtr );
  1631. PROCEDURE Read* [base,-42]
  1632.   ( file       [1] : FileHandlePtr;
  1633.     VAR buffer [2] : ARRAY OF SYS.BYTE;
  1634.     length     [3] : LONGINT)
  1635.   : LONGINT;
  1636. PROCEDURE Write* [base,-48]
  1637.   ( file   [1] : FileHandlePtr;
  1638.     buffer [2] : ARRAY OF SYS.BYTE;
  1639.     length [3] : LONGINT)
  1640.   : LONGINT;
  1641. PROCEDURE Input* [base,-54] ()
  1642.   : FileHandlePtr;
  1643. PROCEDURE Output* [base,-60] ()
  1644.   : FileHandlePtr;
  1645. PROCEDURE Seek* [base,-66]
  1646.   ( file     [1] : FileHandlePtr;
  1647.     position [2] : LONGINT;
  1648.     offset   [3] : LONGINT)
  1649.   : LONGINT;
  1650. PROCEDURE DeleteFile* [base,-72]
  1651.   ( name [1] : ARRAY OF CHAR )
  1652.   : BOOLEAN;
  1653. PROCEDURE Rename* [base,-78]
  1654.   ( oldName [1] : ARRAY OF CHAR;
  1655.     newName [2] : ARRAY OF CHAR )
  1656.   : BOOLEAN;
  1657. PROCEDURE Lock* [base,-84]
  1658.   ( name [1] : ARRAY OF CHAR;
  1659.     type [2] : LONGINT)
  1660.   : FileLockPtr;
  1661. PROCEDURE UnLock* [base,-90]
  1662.   ( lock [1] : FileLockPtr );
  1663. PROCEDURE DupLock* [base,-96]
  1664.   ( lock [1] : FileLockPtr )
  1665.   : FileLockPtr;
  1666. PROCEDURE Examine* [base,-102]
  1667.   ( lock    [1] : FileLockPtr;
  1668.     VAR fib [2] : FileInfoBlock )
  1669.   : BOOLEAN;
  1670. PROCEDURE ExNext* [base,-108]
  1671.   ( lock    [1] : FileLockPtr;
  1672.     VAR fib [2] : FileInfoBlock )
  1673.   : BOOLEAN;
  1674. PROCEDURE Info* [base,-114]
  1675.   ( lock     [1] : FileLockPtr;
  1676.     VAR info [2] : InfoData )
  1677.   : BOOLEAN;
  1678. PROCEDURE CreateDir* [base,-120]
  1679.   ( name [1] : ARRAY OF CHAR )
  1680.   : FileLockPtr;
  1681. PROCEDURE CurrentDir* [base,-126]
  1682.   ( lock [1] : FileLockPtr )
  1683.   : FileLockPtr;
  1684. PROCEDURE IoErr* [base,-132] ()
  1685.   : LONGINT;
  1686. PROCEDURE CreateProc* [base,-138]
  1687.   ( name      [1] : ARRAY OF CHAR;
  1688.     pri       [2] : LONGINT;
  1689.     segList   [3] : e.BPTR;
  1690.     stackSize [4] : LONGINT)
  1691.   : ProcessId;
  1692. PROCEDURE Exit* [base,-144]
  1693.   ( returnCode [1] : LONGINT);
  1694. PROCEDURE LoadSeg* [base,-150]
  1695.   ( name [1] : ARRAY OF CHAR )
  1696.   : e.BPTR;
  1697. PROCEDURE UnLoadSeg* [base,-156]
  1698.   ( seglist [1] : e.BPTR );
  1699. PROCEDURE DeviceProc* [base,-174]
  1700.   ( name [1] : ARRAY OF CHAR )
  1701.   : ProcessId;
  1702. PROCEDURE SetComment* [base,-180]
  1703.   ( name    [1] : ARRAY OF CHAR;
  1704.     comment [2] : ARRAY OF CHAR )
  1705.   : BOOLEAN;
  1706. PROCEDURE SetProtection* [base,-186]
  1707.   ( name    [1] : ARRAY OF CHAR;
  1708.     protect [2] : s.SET32)
  1709.   : BOOLEAN;
  1710. PROCEDURE DateStamp* [base,-192]
  1711.   ( VAR date [1] : DateBase );
  1712. PROCEDURE Delay* [base,-198]
  1713.   ( timeout [1] : e.ULONG);
  1714. PROCEDURE WaitForChar* [base,-204]
  1715.   ( file    [1] : FileHandlePtr;
  1716.     timeout [2] : LONGINT)
  1717.   : BOOLEAN;
  1718. PROCEDURE ParentDir* [base,-210]
  1719.   ( lock [1] : FileLockPtr )
  1720.   : FileLockPtr;
  1721. PROCEDURE IsInteractive* [base,-216]
  1722.   ( file [1] : FileHandlePtr )
  1723.   : BOOLEAN;
  1724. PROCEDURE Execute* [base,-222]
  1725.   ( string [1] : ARRAY OF CHAR;
  1726.     file   [2] : FileHandlePtr;
  1727.     file2  [3] : FileHandlePtr )
  1728.   : BOOLEAN;
  1729.  
  1730. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  1731.  
  1732. (*      DOS Object creation/deletion *)
  1733.  
  1734. PROCEDURE AllocDosObject* [base,-228]
  1735.   ( type [1] : e.ULONG;
  1736.     tags [2] : ARRAY OF u.TagItem )
  1737.   : e.APTR;
  1738. PROCEDURE AllocDosObjectTags* [base,-228]
  1739.   ( type [1]   : e.ULONG;
  1740.     tags [2].. : u.Tag )
  1741.   : e.APTR;
  1742. PROCEDURE FreeDosObject* [base,-234]
  1743.   ( type [1] : e.ULONG;
  1744.     ptr  [2] : e.APTR );
  1745.  
  1746. (*      Packet Level routines *)
  1747.  
  1748. PROCEDURE DoPkt* [base,-240]
  1749.   ( port   [1] : ProcessId;
  1750.     action [2] : LONGINT;
  1751.     arg1   [3] : LONGINT;
  1752.     arg2   [4] : LONGINT;
  1753.     arg3   [5] : LONGINT;
  1754.     arg4   [6] : LONGINT;
  1755.     arg5   [7] : LONGINT)
  1756.   : LONGINT;
  1757. PROCEDURE DoPkt0* [base,-240]
  1758.   ( port   [1] : ProcessId;
  1759.     action [2] : LONGINT)
  1760.   : LONGINT;
  1761. PROCEDURE DoPkt1* [base,-240]
  1762.   ( port   [1] : ProcessId;
  1763.     action [2] : LONGINT;
  1764.     arg1   [3] : LONGINT)
  1765.   : LONGINT;
  1766. PROCEDURE DoPkt2* [base,-240]
  1767.   ( port   [1] : ProcessId;
  1768.     action [2] : LONGINT;
  1769.     arg1   [3] : LONGINT;
  1770.     arg2   [4] : LONGINT)
  1771.   : LONGINT;
  1772. PROCEDURE DoPkt3* [base,-240]
  1773.   ( port   [1] : ProcessId;
  1774.     action [2] : LONGINT;
  1775.     arg1   [3] : LONGINT;
  1776.     arg2   [4] : LONGINT;
  1777.     arg3   [5] : LONGINT)
  1778.   : LONGINT;
  1779. PROCEDURE DoPkt4* [base,-240]
  1780.   ( port   [1] : ProcessId;
  1781.     action [2] : LONGINT;
  1782.     arg1   [3] : LONGINT;
  1783.     arg2   [4] : LONGINT;
  1784.     arg3   [5] : LONGINT;
  1785.     arg4   [6] : LONGINT)
  1786.   : LONGINT;
  1787. PROCEDURE SendPkt* [base,-246]
  1788.   ( VAR dp    [1] : DosPacket;
  1789.     port      [2] : ProcessId;
  1790.     replyport [3] : e.MsgPortPtr );
  1791. PROCEDURE WaitPkt* [base,-252] ()
  1792.   : DosPacketPtr;
  1793. PROCEDURE ReplyPkt* [base,-258]
  1794.   ( dp   [1] : DosPacketPtr;
  1795.     res1 [2] : LONGINT;
  1796.     res2 [3] : LONGINT);
  1797. PROCEDURE AbortPkt* [base,-264]
  1798.   ( port [1] : ProcessId;
  1799.     pkt  [2] : DosPacketPtr );
  1800.  
  1801. (*      Record Locking *)
  1802.  
  1803. PROCEDURE LockRecord* [base,-270]
  1804.   ( fh      [1] : FileHandlePtr;
  1805.     offset  [2] : e.ULONG;
  1806.     length  [3] : e.ULONG;
  1807.     mode    [4] : e.ULONG;
  1808.     timeout [5] : e.ULONG )
  1809.   : BOOLEAN;
  1810. PROCEDURE LockRecords* [base,-276]
  1811.   ( recArray [1] : RecordLockPtr;
  1812.     timeout  [2] : e.ULONG )
  1813.   : BOOLEAN;
  1814. PROCEDURE UnLockRecord* [base,-282]
  1815.   ( fh     [1] : FileHandlePtr;
  1816.     offset [2] : e.ULONG;
  1817.     length [3] : e.ULONG )
  1818.   : BOOLEAN;
  1819. PROCEDURE UnLockRecords* [base,-288]
  1820.   ( recArray [1] : RecordLockPtr )
  1821.   : BOOLEAN;
  1822.  
  1823. (*      Buffered File I/O *)
  1824.  
  1825. PROCEDURE SelectInput* [base,-294]
  1826.   ( fh [1] : FileHandlePtr )
  1827.   : FileHandlePtr;
  1828. PROCEDURE SelectOutput* [base,-300]
  1829.   ( fh [1] : FileHandlePtr )
  1830.   : FileHandlePtr;
  1831. PROCEDURE FGetC* [base,-306]
  1832.   ( fh [1] : FileHandlePtr )
  1833.   : LONGINT;
  1834. PROCEDURE FPutC* [base,-312]
  1835.   ( fh [1] : FileHandlePtr;
  1836.     ch [2] : LONGINT )
  1837.   : LONGINT;
  1838. PROCEDURE UnGetC* [base,-318]
  1839.   ( fh        [1] : FileHandlePtr;
  1840.     character [2] : LONGINT)
  1841.   : LONGINT;
  1842. PROCEDURE FRead* [base,-324]
  1843.   ( fh        [1] : FileHandlePtr;
  1844.     VAR block [2] : ARRAY OF SYS.BYTE;
  1845.     blocklen  [3] : e.ULONG;
  1846.     number    [4] : e.ULONG )
  1847.   : LONGINT;
  1848. PROCEDURE FWrite* [base,-330]
  1849.   ( fh       [1] : FileHandlePtr;
  1850.     block    [2] : ARRAY OF SYS.BYTE;
  1851.     blocklen [3] : e.ULONG;
  1852.     number   [4] : e.ULONG )
  1853.   : LONGINT;
  1854. PROCEDURE FGets* [base,-336]
  1855.   ( fh      [1] : FileHandlePtr;
  1856.     VAR buf [2] : ARRAY OF CHAR;
  1857.     buflen  [3] : e.ULONG )
  1858.   : e.APTR;
  1859. PROCEDURE FPuts* [base,-342]
  1860.   ( fh  [1] : FileHandlePtr;
  1861.     str [2] : ARRAY OF CHAR )
  1862.   : BOOLEAN;
  1863. PROCEDURE VFWritef* [base,-348]
  1864.   ( fh     [1] : FileHandlePtr;
  1865.     format [2] : ARRAY OF CHAR;
  1866.     argv   [3] : ARRAY OF SYS.BYTE )
  1867.   : LONGINT;
  1868. PROCEDURE FWritef* [base,-348]
  1869.   ( fh     [1]   : FileHandlePtr;
  1870.     format [2]   : ARRAY OF CHAR;
  1871.     argv   [3].. : SYS.LONGWORD )
  1872.   : LONGINT;
  1873. PROCEDURE VFPrintf* [base,-354]
  1874.   ( fh     [1] : FileHandlePtr;
  1875.     format [2] : ARRAY OF CHAR;
  1876.     argv   [3] : ARRAY OF SYS.LONGWORD )
  1877.   : LONGINT;
  1878. PROCEDURE FPrintf* [base,-354]
  1879.   ( fh     [1]   : FileHandlePtr;
  1880.     format [2]   : ARRAY OF CHAR;
  1881.     argv   [3].. : SYS.LONGWORD )
  1882.   : LONGINT;
  1883. PROCEDURE Flush* [base,-360]
  1884.   ( fh [1] : FileHandlePtr )
  1885.   : BOOLEAN;
  1886. PROCEDURE SetVBuf* [base,-366]
  1887.   ( fh       [1] : FileHandlePtr;
  1888.     VAR buff [2] : ARRAY OF CHAR;
  1889.     type     [3] : LONGINT;
  1890.     size     [4] : LONGINT)
  1891.   : LONGINT;
  1892. PROCEDURE SetVBufPtr* [base,-366]
  1893.   ( fh   [1] : FileHandlePtr;
  1894.     buff [2] : e.LSTRPTR;
  1895.     type [3] : LONGINT;
  1896.     size [4] : LONGINT)
  1897.   : LONGINT;
  1898.  
  1899. (*     DOS Object Management *)
  1900.  
  1901. PROCEDURE DupLockFromFH* [base,-372]
  1902.   ( fh [1] : FileHandlePtr )
  1903.   : FileLockPtr;
  1904. PROCEDURE OpenFromLock* [base,-378]
  1905.   ( lock [1] : FileLockPtr )
  1906.   : FileHandlePtr;
  1907. PROCEDURE ParentOfFH* [base,-384]
  1908.   ( fh [1] : FileHandlePtr )
  1909.   : FileLockPtr;
  1910. PROCEDURE ExamineFH* [base,-390]
  1911.   ( fh      [1] : FileHandlePtr;
  1912.     VAR fib [2] : FileInfoBlock )
  1913.   : BOOLEAN;
  1914. PROCEDURE SetFileDate* [base,-396]
  1915.   ( name     [1] : ARRAY OF CHAR;
  1916.     VAR date [2] : DateBase )
  1917.   : BOOLEAN;
  1918. PROCEDURE NameFromLock* [base,-402]
  1919.   ( lock       [1] : FileLockPtr;
  1920.     VAR buffer [2] : ARRAY OF CHAR;
  1921.     len        [3] : LONGINT)
  1922.   : BOOLEAN;
  1923. PROCEDURE NameFromFH* [base,-408]
  1924.   ( fh         [1] : FileHandlePtr;
  1925.     VAR buffer [2] : ARRAY OF CHAR;
  1926.     len        [3] : LONGINT)
  1927.   : BOOLEAN;
  1928. PROCEDURE SplitName* [base,-414]
  1929.   ( name      [1] : ARRAY OF CHAR;
  1930.     seperator [2] : CHAR;
  1931.     VAR buf   [3] : ARRAY OF CHAR;
  1932.     oldpos    [4] : LONGINT;
  1933.     size      [5] : LONGINT)
  1934.   : INTEGER;
  1935. PROCEDURE SameLock* [base,-420]
  1936.   ( lock1 [1] : FileLockPtr;
  1937.     lock2 [2] : FileLockPtr )
  1938.   : INTEGER;
  1939. PROCEDURE SetMode* [base,-426]
  1940.   ( fh   [1] : FileHandlePtr;
  1941.     mode [2] : LONGINT)
  1942.   : BOOLEAN;
  1943. PROCEDURE ExAll* [base,-432]
  1944.   ( lock    [1] : FileLockPtr;
  1945.     buffer  [2] : ARRAY OF SYS.BYTE;
  1946.     size    [3] : LONGINT;
  1947.     data    [4] : LONGINT;
  1948.     control [5] : ExAllControlPtr )
  1949.   : BOOLEAN;
  1950. PROCEDURE ReadLink* [base,-438]
  1951.   ( port       [1] : ProcessId;
  1952.     lock       [2] : FileLockPtr;
  1953.     path       [3] : ARRAY OF CHAR;
  1954.     VAR buffer [4] : ARRAY OF CHAR;
  1955.     size       [5] : e.ULONG )
  1956.   : LONGINT;
  1957. PROCEDURE MakeLink* [base,-444]
  1958.   ( name [1] : ARRAY OF CHAR;
  1959.     dest [2] : LONGINT;
  1960.     soft [3] : LONGINT)
  1961.   : LONGINT;
  1962. PROCEDURE ChangeMode* [base,-450]
  1963.   ( type    [1] : LONGINT; (* must be changeFH *)
  1964.     fh      [2] : FileHandlePtr;
  1965.     newmode [3] : LONGINT)
  1966.   : BOOLEAN;
  1967. PROCEDURE ChangeModeLock* [base,-450]
  1968.   ( type    [1] : LONGINT; (* must be changeLock *)
  1969.     fh      [2] : FileLockPtr;
  1970.     newmode [3] : LONGINT)
  1971.   : BOOLEAN;
  1972. PROCEDURE SetFileSize* [base,-456]
  1973.   ( fh   [1] : FileHandlePtr;
  1974.     pos  [2] : LONGINT;
  1975.     mode [3] : LONGINT)
  1976.   : LONGINT;
  1977.  
  1978. (*      Error Handling *)
  1979.  
  1980. PROCEDURE SetIoErr* [base,-462]
  1981.   ( result [1] : LONGINT)
  1982.   : LONGINT;
  1983. PROCEDURE Fault* [base,-468]
  1984.   ( code       [1] : LONGINT;
  1985.     header     [2] : ARRAY OF CHAR;
  1986.     VAR buffer [3] : ARRAY OF CHAR;
  1987.     len        [4] : LONGINT)
  1988.   : LONGINT;
  1989. PROCEDURE PrintFault* [base,-474]
  1990.   ( code   [1] : LONGINT;
  1991.     header [2] : ARRAY OF CHAR )
  1992.   : BOOLEAN;
  1993. PROCEDURE ErrorReport* [base,-480]
  1994.   ( code   [1] : LONGINT;
  1995.     type   [2] : LONGINT;
  1996.     arg1   [3] : DeviceListAPtr;
  1997.     device [8] : ProcessId )
  1998.   : LONGINT;
  1999. PROCEDURE ErrorReportLock* [base,-480]
  2000.   ( code   [1] : LONGINT;
  2001.     type   [2] : LONGINT;
  2002.     arg1   [3] : FileLockPtr;
  2003.     device [8] : ProcessId )
  2004.   : LONGINT;
  2005. PROCEDURE ErrorReportFH* [base,-480]
  2006.   ( code   [1] : LONGINT;
  2007.     type   [2] : LONGINT;
  2008.     arg1   [3] : FileHandlePtr;
  2009.     device [8] : ProcessId )
  2010.   : LONGINT;
  2011. PROCEDURE Requester* [base,-486]
  2012.   ( s1    [1] : ARRAY OF CHAR;
  2013.     s2    [2] : ARRAY OF CHAR;
  2014.     s3    [3] : ARRAY OF CHAR;
  2015.     flags [4] : s.SET32 )
  2016.   : LONGINT;
  2017.  
  2018. (*      Process Management *)
  2019.  
  2020. PROCEDURE Cli* [base,-492] ()
  2021.   : CommandLineInterfaceAPtr;
  2022. PROCEDURE CreateNewProc* [base,-498]
  2023.   ( tags [1] : ARRAY OF u.TagItem )
  2024.   : ProcessPtr;
  2025. PROCEDURE CreateNewProcTags* [base,-498]
  2026.   ( tags [1].. : u.Tag )
  2027.   : ProcessPtr;
  2028. PROCEDURE RunCommand* [base,-504]
  2029.   ( seg      [1] : e.BPTR;
  2030.     stack    [2] : LONGINT;
  2031.     paramptr [3] : ARRAY OF CHAR;
  2032.     paramlen [4] : LONGINT)
  2033.   : LONGINT;
  2034. PROCEDURE GetConsoleTask* [base,-510] ()
  2035.   : ProcessId;
  2036. PROCEDURE SetConsoleTask* [base,-516]
  2037.   ( task [1] : ProcessId )
  2038.   : ProcessId;
  2039. PROCEDURE GetFileSysTask* [base,-522] ()
  2040.   : ProcessId;
  2041. PROCEDURE SetFileSysTask* [base,-528]
  2042.   ( task [1] : ProcessId )
  2043.   : ProcessId;
  2044. PROCEDURE GetArgStr* [base,-534] ()
  2045.   : e.LSTRPTR;
  2046. PROCEDURE SetArgStr* [base,-540]
  2047.   ( string [1] : ARRAY OF CHAR )
  2048.   : e.LSTRPTR;
  2049. PROCEDURE FindCliProc* [base,-546]
  2050.   ( num [1] : e.ULONG )
  2051.   : ProcessPtr;
  2052. PROCEDURE MaxCli* [base,-552] ()
  2053.   : e.ULONG;
  2054. PROCEDURE SetCurrentDirName* [base,-558]
  2055.   ( name [1] : ARRAY OF CHAR )
  2056.   : BOOLEAN;
  2057. PROCEDURE GetCurrentDirName* [base,-564]
  2058.   ( VAR buf [1] : ARRAY OF CHAR;
  2059.     len     [2] : LONGINT)
  2060.   : BOOLEAN;
  2061. PROCEDURE SetProgramName* [base,-570]
  2062.   ( name [1] : ARRAY OF CHAR )
  2063.   : BOOLEAN;
  2064. PROCEDURE GetProgramName* [base,-576]
  2065.   ( VAR buf [1] : ARRAY OF CHAR;
  2066.     len     [2] : LONGINT)
  2067.   : BOOLEAN;
  2068. PROCEDURE SetPrompt* [base,-582]
  2069.   ( name [1] : ARRAY OF CHAR )
  2070.   : BOOLEAN;
  2071. PROCEDURE GetPrompt* [base,-588]
  2072.   ( VAR buf [1] : ARRAY OF CHAR;
  2073.     len     [2] : LONGINT)
  2074.   : BOOLEAN;
  2075. PROCEDURE SetProgramDir* [base,-594]
  2076.   ( lock [1] : FileLockPtr )
  2077.   : FileLockPtr;
  2078. PROCEDURE GetProgramDir* [base,-600] ()
  2079.   : FileLockPtr;
  2080.  
  2081. (*      Device List Management *)
  2082.  
  2083. PROCEDURE System* [base,-606]
  2084.   ( command [1] : ARRAY OF CHAR;
  2085.     tags    [2] : ARRAY OF u.TagItem )
  2086.   : LONGINT;
  2087. PROCEDURE SystemTags* [base,-606]
  2088.   ( command [1]   : ARRAY OF CHAR;
  2089.     tags    [2].. : u.Tag )
  2090.   : LONGINT;
  2091. PROCEDURE AssignLock* [base,-612]
  2092.   ( name [1] : ARRAY OF CHAR;
  2093.     lock [2] : FileLockPtr )
  2094.   : BOOLEAN;
  2095. PROCEDURE AssignLate* [base,-618]
  2096.   ( name [1] : ARRAY OF CHAR;
  2097.     path [2] : ARRAY OF CHAR )
  2098.   : BOOLEAN;
  2099. PROCEDURE AssignPath* [base,-624]
  2100.   ( name [1] : ARRAY OF CHAR;
  2101.     path [2] : ARRAY OF CHAR )
  2102.   : BOOLEAN;
  2103. PROCEDURE AssignAdd* [base,-630]
  2104.   ( name [1] : ARRAY OF CHAR;
  2105.     lock [2] : FileLockPtr )
  2106.   : BOOLEAN;
  2107. PROCEDURE RemAssignList* [base,-636]
  2108.   ( name [1] : ARRAY OF CHAR;
  2109.     lock [2] : FileLockPtr )
  2110.   : LONGINT;
  2111. PROCEDURE GetDeviceProc* [base,-642]
  2112.   ( name [1] : ARRAY OF CHAR;
  2113.     dp   [2] : DevProcPtr )
  2114.   : DevProcPtr;
  2115. PROCEDURE FreeDeviceProc* [base,-648]
  2116.   ( dp [1] : DevProcPtr );
  2117. PROCEDURE LockDosList* [base,-654]
  2118.   ( flags [1] : s.SET32 )
  2119.   : DosListNodePtr;
  2120. PROCEDURE UnLockDosList* [base,-660]
  2121.   ( flags [1] : s.SET32 );
  2122. PROCEDURE AttemptLockDosList* [base,-666]
  2123.   ( flags [1] : s.SET32 )
  2124.   : DosListNodePtr;
  2125. PROCEDURE RemDosEntry* [base,-672]
  2126.   ( dlist [1] : DosListNodePtr )
  2127.   : BOOLEAN;
  2128. PROCEDURE AddDosEntry* [base,-678]
  2129.   ( dlist [1] : DosListNodePtr )
  2130.   : DosListNodePtr;
  2131. PROCEDURE FindDosEntry* [base,-684]
  2132.   ( dlist [1] : DosListNodePtr;
  2133.     name  [2] : ARRAY OF CHAR;
  2134.     flags [3] : s.SET32 )
  2135.   : DosListNodePtr;
  2136. PROCEDURE NextDosEntry* [base,-690]
  2137.   ( dlist [1] : DosListNodePtr;
  2138.     flags [2] : s.SET32 )
  2139.   : DosListNodePtr;
  2140. PROCEDURE MakeDosEntry* [base,-696]
  2141.   ( name [1] : ARRAY OF CHAR;
  2142.     type [2] : LONGINT)
  2143.   : DosListNodePtr;
  2144. PROCEDURE FreeDosEntry* [base,-702]
  2145.   ( dlist [1] : DosListNodePtr );
  2146. PROCEDURE IsFileSystem* [base,-708]
  2147.   ( name [1] : ARRAY OF CHAR )
  2148.   : BOOLEAN;
  2149.  
  2150. (*      Handler Interface *)
  2151.  
  2152. PROCEDURE Format* [base,-714]
  2153.   ( filesystem [1] : ARRAY OF CHAR;
  2154.     volumename [2] : ARRAY OF CHAR;
  2155.     dostype    [3] : e.ULONG )
  2156.   : BOOLEAN;
  2157. PROCEDURE Relabel* [base,-720]
  2158.   ( drive   [1] : ARRAY OF CHAR;
  2159.     newname [2] : ARRAY OF CHAR )
  2160.   : BOOLEAN;
  2161. PROCEDURE Inhibit* [base,-726]
  2162.   ( name  [1] : ARRAY OF CHAR;
  2163.     onoff [2] : LONGINT)
  2164.   : BOOLEAN;
  2165. PROCEDURE AddBuffers* [base,-732]
  2166.   ( name   [1] : ARRAY OF CHAR;
  2167.     number [2] : LONGINT)
  2168.   : BOOLEAN;
  2169.  
  2170. (*      Date, Time Routines *)
  2171.  
  2172. PROCEDURE CompareDates* [base,-738]
  2173.   ( VAR date1 [1] : DateBase;
  2174.     VAR date2 [2] : DateBase )
  2175.   : LONGINT;
  2176. PROCEDURE DateToStr* [base,-744]
  2177.   ( VAR datetime [1] : DateTime )
  2178.   : BOOLEAN;
  2179. PROCEDURE StrToDate* [base,-750]
  2180.   ( VAR datetime [1] : DateTime )
  2181.   : BOOLEAN;
  2182.  
  2183. (*      Image Management *)
  2184.  
  2185. PROCEDURE InternalLoadSeg* [base,-756]
  2186.   ( fh         [1] : FileHandlePtr;
  2187.     table      [8] : e.BPTR;
  2188.     funcarray  [9] : e.APTR;
  2189.     VAR stack [10] : LONGINT )
  2190.   : e.BPTR;
  2191. PROCEDURE InternalUnLoadSeg* [base,-762]
  2192.   ( seglist  [1] : e.BPTR;
  2193.     freefunc [9] : e.PROC )
  2194.   : BOOLEAN;
  2195. PROCEDURE NewLoadSeg* [base,-768]
  2196.   ( file [1] : ARRAY OF CHAR;
  2197.     tags [2] : ARRAY OF u.TagItem )
  2198.   : e.BPTR;
  2199. PROCEDURE NewLoadSegTags* [base,-768]
  2200.   ( file [1]   : ARRAY OF CHAR;
  2201.     tags [2].. : u.Tag )
  2202.   : e.BPTR;
  2203. PROCEDURE AddSegment* [base,-774]
  2204.   ( name   [1] : ARRAY OF CHAR;
  2205.     seg    [2] : e.BPTR;
  2206.     system [3] : LONGINT)
  2207.   : BOOLEAN;
  2208. PROCEDURE FindSegment* [base,-780]
  2209.   ( name   [1] : ARRAY OF CHAR;
  2210.     seg    [2] : SegmentPtr;
  2211.     system [3] : LONGINT)
  2212.   : SegmentPtr;
  2213. PROCEDURE RemSegment* [base,-786]
  2214.   ( seg [1] : SegmentPtr )
  2215.   : BOOLEAN;
  2216.  
  2217. (*      Command Support *)
  2218.  
  2219. PROCEDURE CheckSignal* [base,-792]
  2220.   ( mask [1] : s.SET32)
  2221.   : s.SET32;
  2222. PROCEDURE OldReadArgs* [base,-798]
  2223.   ( template  [1] : ARRAY OF CHAR;
  2224.     VAR array [2] : ARRAY OF SYS.BYTE;
  2225.     args      [3] : RDArgsPtr )
  2226.   : RDArgsPtr;
  2227. PROCEDURE ReadArgs* [base,-798]
  2228.   ( template  [1] : ARRAY OF CHAR;
  2229.     VAR array [2] : ArgsStruct;
  2230.     args      [3] : RDArgsPtr )
  2231.   : RDArgsPtr;
  2232. PROCEDURE FindArg* [base,-804]
  2233.   ( template [1] : ARRAY OF CHAR;
  2234.     keyword  [2] : ARRAY OF CHAR )
  2235.   : LONGINT;
  2236. PROCEDURE ReadItem* [base,-810]
  2237.   ( VAR name [1] : ARRAY OF CHAR;
  2238.     maxchars [2] : LONGINT;
  2239.     cSource  [3] : CSourcePtr )
  2240.   : LONGINT;
  2241. PROCEDURE StrToLong* [base,-816]
  2242.   ( string    [1] : ARRAY OF CHAR;
  2243.     VAR value [2] : LONGINT )
  2244.   : LONGINT;
  2245. PROCEDURE MatchFirst* [base,-822]
  2246.   ( pat        [1] : ARRAY OF CHAR;
  2247.     VAR anchor [2] : AnchorPath )
  2248.   : LONGINT;
  2249. PROCEDURE MatchNext* [base,-828]
  2250.   ( VAR anchor [1] : AnchorPath )
  2251.   : LONGINT;
  2252. PROCEDURE MatchEnd* [base,-834]
  2253.   ( VAR anchor [1] : AnchorPath );
  2254. PROCEDURE ParsePattern* [base,-840]
  2255.   ( pat     [1] : ARRAY OF CHAR;
  2256.     VAR buf [2] : ARRAY OF CHAR;
  2257.     buflen  [3] : LONGINT)
  2258.   : INTEGER;
  2259. PROCEDURE MatchPattern* [base,-846]
  2260.   ( pat [1] : ARRAY OF CHAR;
  2261.     str [2] : ARRAY OF CHAR )
  2262.   : BOOLEAN;
  2263. PROCEDURE FreeArgs* [base,-858]
  2264.   ( args [1] : RDArgsPtr );
  2265. PROCEDURE FilePart* [base,-870]
  2266.   ( path [1] : ARRAY OF CHAR )
  2267.   : e.LSTRPTR;
  2268. PROCEDURE PathPart* [base,-876]
  2269.   ( path [1] : ARRAY OF CHAR )
  2270.   : e.LSTRPTR;
  2271. PROCEDURE AddPart* [base,-882]
  2272.   ( VAR dirname [1] : ARRAY OF CHAR;
  2273.     filename    [2] : ARRAY OF CHAR;
  2274.     size        [3] : e.ULONG )
  2275.   : BOOLEAN;
  2276.  
  2277. (*      Notification *)
  2278.  
  2279. PROCEDURE StartNotify* [base,-888]
  2280.   ( VAR notify [1] : NotifyRequest )
  2281.   : BOOLEAN;
  2282. PROCEDURE EndNotify* [base,-894]
  2283.   ( VAR notify [1] : NotifyRequest );
  2284.  
  2285. (*      Environment Variable functions *)
  2286.  
  2287. PROCEDURE SetVar* [base,-900]
  2288.   ( name       [1] : ARRAY OF CHAR;
  2289.     VAR buffer [2] : ARRAY OF CHAR;
  2290.     size       [3] : LONGINT;
  2291.     flags      [4] : s.SET32)
  2292.   : BOOLEAN;
  2293. PROCEDURE GetVar* [base,-906]
  2294.   ( name       [1] : ARRAY OF CHAR;
  2295.     VAR buffer [2] : ARRAY OF CHAR;
  2296.     size       [3] : LONGINT;
  2297.     flags      [4] : s.SET32)
  2298.   : LONGINT;
  2299. PROCEDURE DeleteVar* [base,-912]
  2300.   ( name  [1] : ARRAY OF CHAR;
  2301.     flags [2] : s.SET32 )
  2302.   : BOOLEAN;
  2303. PROCEDURE FindVar* [base,-918]
  2304.   ( name [1] : ARRAY OF CHAR;
  2305.     type [2] : s.SET32 )
  2306.   : LocalVarPtr;
  2307. PROCEDURE CliInit* [base,-924]
  2308.   ( VAR dp [8] : DosPacket )
  2309.   : s.SET32;
  2310. PROCEDURE CliInitNewcli* [base,-930]
  2311.   ( VAR dp [8] : DosPacket )
  2312.   : s.SET32;
  2313. PROCEDURE CliInitRun* [base,-936]
  2314.   ( VAR dp [8] : DosPacket )
  2315.   : s.SET32;
  2316. PROCEDURE WriteChars* [base,-942]
  2317.   ( buf    [1] : ARRAY OF CHAR;
  2318.     buflen [2] : LONGINT )
  2319.   : LONGINT;
  2320. PROCEDURE PutStr* [base,-948]
  2321.   ( str [1] : ARRAY OF CHAR )
  2322.   : LONGINT;
  2323. PROCEDURE VPrintf* [base,-954]
  2324.   ( format   [1] : ARRAY OF CHAR;
  2325.     argarray [2] : ARRAY OF SYS.BYTE )
  2326.   : LONGINT;
  2327. PROCEDURE Printf* [base,-954]
  2328.   ( format   [1]   : ARRAY OF CHAR;
  2329.     argarray [2].. : SYS.LONGWORD )
  2330.   : LONGINT;
  2331. PROCEDURE PrintF* [base,-954]
  2332.   ( format   [1]   : ARRAY OF CHAR;
  2333.     argarray [2].. : SYS.LONGWORD );
  2334.  
  2335. (* these were unimplemented until dos 36.147 *)
  2336.  
  2337. PROCEDURE ParsePatternNoCase* [base,-966]
  2338.   ( pat     [1] : ARRAY OF CHAR;
  2339.     VAR buf [2] : ARRAY OF CHAR;
  2340.     buflen  [3] : LONGINT)
  2341.   : INTEGER;
  2342. PROCEDURE MatchPatternNoCase* [base,-972]
  2343.   ( pat [1] : ARRAY OF CHAR;
  2344.     str [2] : ARRAY OF CHAR )
  2345.   : BOOLEAN;
  2346.  
  2347. (* this was added for V37 dos; returned 0 before then. *)
  2348.  
  2349. PROCEDURE SameDevice* [base,-984]
  2350.   ( lock1 [1] : FileLockPtr;
  2351.     lock2 [2] : FileLockPtr )
  2352.   : BOOLEAN;
  2353.  
  2354. (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
  2355. (* If you are going to use them, open dos.library with version 37 *)
  2356.  
  2357. (* These calls were added for V39 dos: *)
  2358. PROCEDURE ExAllEnd* [base,-990]
  2359.   ( lock    [1] : FileLockPtr;
  2360.     buffer  [2] : ARRAY OF SYS.BYTE;
  2361.     size    [3] : LONGINT;
  2362.     data    [4] : LONGINT;
  2363.     control [5] : ExAllControlPtr );
  2364. PROCEDURE SetOwner* [base,-996]
  2365.   ( name      [1] : ARRAY OF CHAR;
  2366.     ownerInfo [2] : OwnerInfo)
  2367.   : BOOLEAN;
  2368.  
  2369.  
  2370. (**-- C Macros ---------------------------------------------------------*)
  2371.  
  2372. (*
  2373. **      $VER: stdio.h 36.6 (1.11.91)
  2374. **
  2375. **      ANSI-like stdio defines for dos buffered I/O
  2376. *)
  2377.  
  2378.  
  2379. PROCEDURE [0] ReadChar * () : CHAR;
  2380.   VAR c : LONGINT;
  2381. BEGIN
  2382.   c := FGetC (Input());
  2383.   IF (c < 0) OR (c > 255) THEN c := 0 END;
  2384.   RETURN CHR(c)
  2385. END ReadChar;
  2386.  
  2387. PROCEDURE [0] WriteChar * ( c : CHAR ) : LONGINT;
  2388. BEGIN
  2389.   RETURN FPutC (Output (), ORD (c))
  2390. END WriteChar;
  2391.  
  2392. PROCEDURE [0] UnReadChar * ( c : CHAR ) : LONGINT;
  2393. BEGIN
  2394.   RETURN UnGetC (Input(), ORD(c))
  2395. END UnReadChar;
  2396.  
  2397. (* next one is inefficient *)
  2398.  
  2399. PROCEDURE [0] ReadChars *
  2400.   (VAR buf : ARRAY OF SYS.BYTE; num : LONGINT)
  2401.   : LONGINT;
  2402. BEGIN
  2403.   RETURN FRead (Input (), buf, 1, num)
  2404. END ReadChars;
  2405.  
  2406. PROCEDURE [0] ReadLn * (VAR buf : ARRAY OF CHAR; len : LONGINT) : e.APTR;
  2407. BEGIN
  2408.   RETURN FGets (Input (), buf, len)
  2409. END ReadLn;
  2410.  
  2411. PROCEDURE [0] WriteStr * (s : ARRAY OF CHAR) : BOOLEAN;
  2412. <*$CopyArrays-*>
  2413. BEGIN
  2414.   RETURN FPuts (Output (), s)
  2415. END WriteStr;
  2416.  
  2417. PROCEDURE [0] VWritef *
  2418.   (format : ARRAY OF CHAR; argv : ARRAY OF SYS.BYTE)
  2419.   : LONGINT;
  2420. <*$CopyArrays-*>
  2421. BEGIN
  2422.   RETURN VFWritef (Output(), format, argv)
  2423. END VWritef;
  2424.  
  2425. (*
  2426.  * Use this to convert a ProcessId (eg. WBStartup.process) to a ProcessPtr.
  2427.  *)
  2428. PROCEDURE [0] ProcessIdToProcess*(id: ProcessId): ProcessPtr;
  2429. BEGIN
  2430.   RETURN SYS.VAL(ProcessPtr,SYS.VAL(LONGINT,id)-SIZE(e.Task))
  2431. END ProcessIdToProcess;
  2432.  
  2433. (*
  2434.  * Use this to get a Process' ProcessId, ie. a pointer to its MsgPort.
  2435.  *)
  2436. PROCEDURE [0] ProcessToProcessId*(proc: ProcessPtr): ProcessId;
  2437. BEGIN
  2438.   RETURN SYS.ADR(proc.msgPort);
  2439. END ProcessToProcessId;
  2440.  
  2441. (**-- Library Base variable --------------------------------------------*)
  2442.  
  2443. <*$LongVars-*>
  2444.  
  2445. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  2446.  
  2447. BEGIN (* CloseLib *)
  2448.   IF base # NIL THEN e.CloseLibrary (base) END;
  2449. END CloseLib;
  2450.  
  2451. BEGIN (* Dos *)
  2452.   base := SYS.VAL (DosLibraryPtr,
  2453.                    e.OpenLibrary (dosName, e.libraryMinimum));
  2454.   IF base = NIL THEN HALT (100) END;
  2455.   Kernel.SetCleanup (CloseLib)
  2456. END Dos.
  2457.